Search This Blog

Sunday, January 31, 2010

Find string in file - Replace string - linux command

find string in file:
grep -r "MAX_BUFF_SIZE" $PWD

only in txt file
grep -r "MAX_BUFF_SIZE" /home/*.txt

OR (fing blabla in rmak file)

find . -name rmak |xargs grep -i 'blabla '


find replace:
the next command will look for "-fpermissive" in rmak files and replace it with "-fpermissive -m32" string
find ./ -name rmak | xargs sed -i -e 's/-fpermissive/-fpermissive -m32/g'


Yaniv

No comments: