in reply to Re: Regex question
in thread Regex question
Thanks for responses guys!
Here's my first whack at it
#!/usr/bin/perl use Getopt::Long; GetOptions( 'd=s' => \$delete, 'i=s' => \$patternmatch, 'c=s' => \$confile, ) open (FILE, $confile); while (<FILE>) { $line[$.] = $_; if (/$patternmatch/) { delete $line[$_] for ($.-5 .. $.); } } close(FILE); open (OUTPUT, ">$confile"); print (OUTPUT @line); close (OUTPUT);
perl ./dellines.pl -i <patternmatch> -c ./someconfile -d
I'm also trying to get the (-d) to be a stand-alone flag. What would be the best approach to this?
Thanks, Jim
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex question
by ikegami (Patriarch) on Jan 26, 2009 at 05:16 UTC |