J
jason
Hello. New to Perl and trying to figure out if beter way to do the
following (in Active State Perl under Windows 2000):
I have this DOS text file with about 20,000 lines. In the simple
example below I can extract lines that contain a particular string.
$db = "work.txt";
open (FILE,"$db");
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;
print $SIZE,"\n";
for ($i=0;$i<=$SIZE;$i++)
{
$_=$LINES[$i];
if (/motion/i)
{print "$_";}
}
How can I extract:
1. 5 lines before and after the string
2. Columns positions 5-15 (for all selected)
3. Limit selection to rows 5000-7000
4. The last 5 lines of the entire file
Many Thanks for any help or information!!
following (in Active State Perl under Windows 2000):
I have this DOS text file with about 20,000 lines. In the simple
example below I can extract lines that contain a particular string.
$db = "work.txt";
open (FILE,"$db");
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;
print $SIZE,"\n";
for ($i=0;$i<=$SIZE;$i++)
{
$_=$LINES[$i];
if (/motion/i)
{print "$_";}
}
How can I extract:
1. 5 lines before and after the string
2. Columns positions 5-15 (for all selected)
3. Limit selection to rows 5000-7000
4. The last 5 lines of the entire file
Many Thanks for any help or information!!