I am guessing you want to find the first line of the two lines that don't start with a space. If you wanted to find the second line you could just print line instead of previous_line.#!/usr/bin/perl -w use strict; my $previous_line = ""; my $line = ""; open (DATA, "/export/home/webadm/scripts/backup_scripts/backup_data/1s +tnodupe"); while (<DATA>) { chop; $line = $_; if ($line =~ /^\S/) { # if line starts with Non-White Space Charac +ter if ($previous_line =~ /^\S/) { # if the previous line als +o # starts with Non-White Space +Character # then do something with your successful finding like... print "$previous_line\n"; } else { # do something if not } } $previous_line = $line; }
If this is way off, try to explain it better and I'll give it another go.
Thanks,
EEjack
In reply to Re: printing needed info only
by eejack
in thread printing needed info only
by Er1kW
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |