2007-09-13

Using Perl as Grep or Sed

  • perl -ne '/pattern/ and print' ...
  • perl -lne '/pattern/ and print' ...
  • perl -pe 's/foo/bar/' ...
  • perl -pe 's/^foo.*//' ...
  • perl -lpe 's/^foo.*//' ...
  • perl -pi -e 's/foo/bar/' ...
  • perl -pli -e 's/foo/bar/' ...

No comments: