buy tb500

Find and replace in Linux file

if in single file

sed -i ‘s/ugly/beautiful/g’ /home/bruno/old-friends/sue.txt

if in multiple files

$ find /home/bruno/old-friends -type f -exec sed -i ‘s/ugly/beautiful/g’ {} \;

 

Thanks.

 

Leave a Reply