Perl-Sensitive Sunglasses | |
PerlMonks |
extract trailer count one linerby dirtdog (Monk) |
on Jan 13, 2014 at 17:30 UTC ( [id://1070435]=perlquestion: print w/replies, xml ) | Need Help?? |
dirtdog has asked for the wisdom of the Perl Monks concerning the following question: Hi Monks I'm stuck trying to extract the Trailer count from a file that contains a Header and Trailer within brackets. I have the following one-liner so far, but it doesn't quite get exactly what i need perl -ne 'print "$1\n" if /\[(.*?)\]/;' <filename>Sample input looks like this:
The data content is swift data and is not surrounded by brackets so is not relevant for this example. My expected result would be 345 in this example. Also, other samples of what the trailer record could be are: [TRL0] or [TRL25678]It's a variable length count with no leading zeroes. Any help would be greatly appreciated thanks
Back to
Seekers of Perl Wisdom
|
|