Search and replace using perl?

Abdul Wahab MP

New member
How to search and replace using perl
Hello all,

Plz do understand that i don't have any prior knowledge in perl before and hence this must be a basic one.

Basically what i want is search and replace. I have googled and hence a found this site. There are lots if threads regarding this in this site, but it does give me syntax error. I will tell you a sample scenario to explain my case. I have directory /home/sample, it contains lots of normal files. The files contaiNs teXt such as,
MX-HELLO
RS=ASD
JOHN
RS=ASFG

Now i want replace all the words starting with AS(actually only starting with RS=AS ).
These are the some code i have used.

find /home/sample/ -type f | xargs perl -pi -e "s/RS=AS*/RS=WQ/g"

find -type f | perl -pi -e "s/RS=AS*/RS=WQ/g"

perl -e "s/RS=AS*/RS=WQ/g;" -pi.save $(find /home/sample -type f)

But it all gives syntax error. I i don't knw i how to fix them.

Please help me.

Thank you
 
Back
Top