in reply to Scanning a file for a match, printing different part of the line when found.
You can do this sort of thing with a one-liner. You don't specify what you want to match in much detail, but here is an example:
perl -ne 'print "$1\n" if /Name:\s*(.+?)\b/' search.txt
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Scanning a file for a match, printing different part of the line when found.
by ww (Archbishop) on Mar 26, 2011 at 20:21 UTC |
In Section
Seekers of Perl Wisdom