in reply to Extracting and manipulating a range of lines
it would've been easier not to print the caption line)while ($l = <DATA>){ $_++ if $l=~m/Some Field/; $a[$_]{$1} = $2 if $l=~m/^(\w+\s\w+)\s*\:\s(\w+\s\w+|\w+)$/; $a[0]{$1} = $1; } foreach $a (@a){ printf "%-15s %-15s %-15s %-15s\n", map{${$a}{$_}} sort {$b =~ +m/S/}keys %$a; } __DATA__ Some Field : some value Another Field: 1234 Different One: 5678 Yet Another : foo line of uninteresting stuff Some Field : some else Another Field: 4321 Different One: 8765 Yet Another : bar more junk Some Field : another value Another Field: 1122 Different One: 5566 Yet Another : baz
|
|---|