better unix life

File mass replace

Use the sed -i command


Perl is the preferred way, but on some production system you must use the old good sed. For some tips on sed take a look to its faq.


Another very powerful command is xargs. Xargs is a rapid  way to process files containing spaces, using  a  combo with find:

Xargs is normally fastest then relaying on backtick substitution. For instance:

ls $(find . -type f)

is  slower then

find . -type f | xargs ls

because this second form create two process which works at the same time, using the unix pipe.

Comments are closed.