Difference between revisions of "Perl"
From Teknologisk videncenter
m |
m (→Search and replace in files) |
||
Line 4: | Line 4: | ||
== Search and replace in files == | == Search and replace in files == | ||
You could also use find and sed. | You could also use find and sed. | ||
− | < | + | <source lang=cli> |
perl -pi -w -e 's/SEARCH/REPLACE/g;' *.php | perl -pi -w -e 's/SEARCH/REPLACE/g;' *.php | ||
− | </ | + | </source> |
*e means execute the following line of code. | *e means execute the following line of code. | ||
*i means edit in-place | *i means edit in-place | ||
*w write warnings | *w write warnings | ||
*p loop | *p loop | ||
− | + | {{Source cli}} | |
[[Category:Perl]][[Category:Programming]] | [[Category:Perl]][[Category:Programming]] |
Revision as of 18:14, 18 June 2010
- wikiversity perl
One liners
Search and replace in files
You could also use find and sed.
perl -pi -w -e 's/SEARCH/REPLACE/g;' *.php
- e means execute the following line of code.
- i means edit in-place
- w write warnings
- p loop