Perl Monk, Perl Meditation | |
PerlMonks |
Re: Scanning a file for a match, printing different part of the line when found.by philipbailey (Curate) |
on Mar 26, 2011 at 19:42 UTC ( [id://895691]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|