Sostituire una stringa in files con Perl: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
 
Line 2: Line 2:


  perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c
  perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c
Oppure
perl -pi -e ’s{original string}{replacement string}g’ *


Vedere ahnche [http://www-128.ibm.com/developerworks/linux/library/l-p102.html Cultured Perl: One-liners 102:] per vedere anche come cancellare delle linee da un file o editarlo
Vedere ahnche [http://www-128.ibm.com/developerworks/linux/library/l-p102.html Cultured Perl: One-liners 102:] per vedere anche come cancellare delle linee da un file o editarlo
==Riferimenti==
*[http://www.philchen.com/2007/05/28/string-substitution-in-perl-vs-sed-removing-disk-io-factor/ Phil Chen » String Substitution in PERL vs SED Removing Disk I/O Factor]

Latest revision as of 13:25, 15 July 2007

Fare:

perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c

Oppure

perl -pi -e ’s{original string}{replacement string}g’ *

Vedere ahnche Cultured Perl: One-liners 102: per vedere anche come cancellare delle linee da un file o editarlo

Riferimenti