Penguin
Diff: PerlOneLiners
EditPageHistoryDiffInfoLikePages

Differences between version 22 and revision by previous author of PerlOneLiners.

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 22 Last edited on Wednesday, June 9, 2004 10:57:42 pm by AristotlePagaltzis Revert
Older page: version 21 Last edited on Wednesday, June 9, 2004 8:46:30 pm by JohnMcPherson Revert
@@ -5,11 +5,9 @@
 !! Perl pie 
  
  perl -pi -e 's/foo/bar/' file 
  
-Does an inplace sed on the file. [GNU] sed(1) v4 also supports this with -i. The advantage of using perl instead  
-of sed is for use of perl 's RegularExpressions if you are more familiar with them than the [POSIX] ones used by sed .  
-(If you only need a simple query and replacement, sed will probably be quicker ). 
+Does an inplace [SED] on the file. [GNU] sed(1) v4 also supports this with __ -i__ and will probably be quicker if you only need a simple query and replacement . However, [Perl] 's [RegularExpression]s are more powerful and easier on the hands than the [POSIX] variety offered by [SED] . With [GNU] sed(1 ), you can use the __-r__ switch to get an extended RegularExpression syntax which also requires fewer backslashes than the [POSIX] flavour
  
 !! Removing empty lines from a file 
  
  perl -ni.bak -e'/\S/ && print' file1 file2