in reply to (How) can I use regex patterns to find matching lines in a textfile?
#!/usr/bin/perl my $x=0;open(OF, ">OUT.txt");open(IF, "<IN.txt"); while(<IF>){if(/$ARGV[1]/){print OF "$_" if $x < $ARGV[0];$x++}} close IF;close OF;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: (How) can I use regex patterns to find matching lines in a textfile?
by Ritter (Sexton) on Nov 20, 2002 at 12:32 UTC | |
by husoft (Monk) on Nov 20, 2002 at 12:40 UTC | |
by Ritter (Sexton) on Nov 20, 2002 at 12:56 UTC |