Few useful Unix commands

Replace a text in a file by another using perl command.
perl -pi -e 's/nobal/nobal niraula/g' a.xml 
This command replaces "nobal" by "nobal niraula" in a.xml. we can do this task in multiple file. e.g. just give *.xml as argument if you want to replace in multiple xml file.

Find line(s) in a file containing a given text
grep "nobal" file.txt

0 comments:

Post a Comment