in reply to Caputre Entire Line Not Just Find
Note that . matches every character but a newline, so there's no need to worry about chomping. See s in Modifiers in perlre.while (<FILE>) { if (/(.*$find.*)/) { $header = $1; } elsif (/^\s{38}\S*/) { print NEW "$header\t", $_; } }
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Caputre Entire Line Not Just Find
by jlope043 (Acolyte) on Jul 13, 2016 at 16:41 UTC |