Replace using Perl
22 marzo 2008 at 11:51
Posted in
Computers
Tags: perl, replace, tip
This tip probably seems a bit stupid, but I have always found very useful. If we want to replace a string in a file with another string, we can do it easily using Perl:
perl -p -i -e 's|old_string|new_string|' file.xml
Of course, if we need to apply it to several files we can use a wildcard character.






Rafa
22 mar 2008 19:03:02
¿Perl? ¿No hubiese sido más apropiado usar sed?
http://www.ss64.com/bash/sed.html
Saludos ;)
Alfonso Jiménez
22 mar 2008 22:54:49
También, también :)
Saludos!
Sevein
23 mar 2008 22:22:00
"The Enlightened Ones say that you should never use C if you can do it with a script, never use a script if you can do it with awk, never use awk if you can do it with sed, and never use sed if you can do it with grep."