Posted By

fugue on 04/03/12


regex find

Versions (?)

Print any line matching the regular expression /foo/ in input.txt

 / Published in: Perl


-n means loop over the lines of all file names given on the command line, or standard input if none were given. -E is a version of -e that enables newer features like say, which is the same as print but adds a newline.

  1. perl -nE 's/\s+$//, say if /foo/' input.txt

Report this snippet  

You need to login to post a comment.