in reply to Regex in a printfile?
use List::MoreUtils qw( apply ); print OUTFILE apply { s/\s*#.*//; } grep { !/^\s*#/ } <INFILE>;
If you want to keep the lines that contained nothing but comments, remove the grep.
List::MoreUtils is not a core module, but it is a very useful module. It can be installed using ppm install List-MoreUtils if you're using ActivePerl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex in a printfile?
by Andrew_Levenson (Hermit) on Nov 16, 2006 at 02:00 UTC | |
by ikegami (Patriarch) on Nov 16, 2006 at 02:13 UTC | |
by Andrew_Levenson (Hermit) on Nov 16, 2006 at 02:57 UTC | |
by ikegami (Patriarch) on Nov 16, 2006 at 03:19 UTC |