in reply to Re^2: re-ordering lines of text in a file?
in thread re-ordering lines of text in a file?

I am puzzled how this could ... be input without major problems

If you need to create a separate record for each value then try

#!perl use strict; use DBI; use Text::ParseWords 'quotewords'; open OUT,'>','output.txt' or die "$!"; my @infiles = glob("*.odf"); for my $infile (@infiles){ open IN,'<',$infile or die "Could not open $infile : $!"; print "Reading $infile.."; my $count=0; while (<IN>){ chomp; ++$count; my ($key,$string) = split /\s*=\s*/,$_; my @values = quotewords('\s+',0,$string); for my $i (1..@values){ printf OUT "%-30s %-35s %-35s %5d\n", $infile,$key,$values[$i-1],$i; } } print "$count lines read\n"; }
poj

Replies are listed 'Best First'.
Re^4: re-ordering lines of text in a file?
by moddingforfun (Initiate) on Dec 02, 2016 at 14:26 UTC

    Thank you.

    You got the old mental gears turning, and even pointed me in the right direction with that tutorial.

    Figured out *why* the shell script was not working .... the 'expression'. Instead of grep 'term-goes-here', it needed to be grep 'term-goes-here.*'. That returns the rest of the line with the 'expression'.

    I learned something anyways ... Thank You.