in reply to Look ahead and comp if pattern matches next line

I'd suggest walking through the file one line at a time. Some thing along the lines of the following (I don't know the sort of data structure you'd be using):
my @records = (); my %current = (); while (<FILE>) { my @line = split /\s*\|/; if ($line[0] =~ /^\S/) { if (keys %current) { push @records, {%current}; %current = (); } @current{qw/name var1 var2 var3/} = @line; } elsif ($line[0] =~ /^ (.*)/) { $current{name} .= $1; } else { # Deal with the other lines as you need to.. } } push @records, {%current};
Hope this helps.

 
perl -e 'print "I love $^X$\"$]!$/"#$&V"+@( NO CARRIER'

Replies are listed 'Best First'.
Re: Re: Look ahead and comp if pattern matches next line
by Er1kW (Initiate) on Apr 28, 2001 at 03:38 UTC
    This gives me a start.
    I will play with it over the weekend.
    I am attempting to make it 3 lines of data per circuit.
    So just need to add the first section of the extra line up to the previous line.

    This ends up being a flat file split by : for later use
    in a web based reporting tool
    The problem I am having right now is they are unable to
    search some circuits because the original reporting tool
    truncated the extra onto the next line

    Thank you again at least now I have a little bit to chew on
    Er1KW