in reply to Getting a Human Readable Report from a data file

Thanks for a very clear statement of the goal. Many here would also be grateful to see what sort of code you have tried, so we could see if your problems are few or many...

In any case, the solution would depend on how easy it is to identify boundaries between consecutive records, given that each record consists of multiple lines with rather intricate white-space formatting. The example suggests that each new record begins with this sort of pattern, which can be used to capture this part of the info for the report:

/^(BCG-\d+)/ # i.e. line-initial "BCG-" followed by digits
and that the "SNBX" and "TRX" records always follow line-initial whitespace, so they can be captured as follows:
/^\s+(SNBX\S+)/ /^\s+(TRX-\d+)\s+\S+\s+BL-TRX/
If those assumptions hold, then the logic could go something like this (not tested):
print "BCG LOCATION TRX STATUS\n"; print "---------------------------------\n"; while (<>) { if (/^(BCG-\d+)/) { # start of record $recid = $1; $loc = $trx = $stat = ""; } elsif (/^\s+(SNB\S+)/) { $loc = $1; } elsif (/^\s+(TRX\S+)\s+\S+\s+(BL-TRX)/) { print "$recid $loc $1 $2\n"; } }
That would probably need some tweaking to get the column alignments right -- you could try the FORMAT mechanism (which I never really got the hang of) or the printf function (which I've been hooked on since cutting my teeth in C years ago).