I have a pipe delimited flat file which has 1 record per invoice-number. Per invoice records, there's header section, lines section (repeated multiple times - could go as much as 100 times) and the trailer section - something like this:
HA1|HA2|HA3|L1-1|L1-2|L1-3|L1-4|L2-1|L2-2|L2-3|L2-4|T1|T2|T3
HB1|HB2|HB3|L1-1|L1-2|L1-3|L1-4|L2-1|L2-2|L2-3|L2-4|T1|T2|T3
The output file should like this:
HA1|HA2|HA3|L1-1|T1|T2|T3
HA1|HA2|HA3|L1-2|T1|T2|T3
HA1|HA2|HA3|L1-3|T1|T2|T3
HA1|HA2|HA3|L1-4|T1|T2|T3
HA1|HA2|HA3|L2-1|T1|T2|T3
HA1|HA2|HA3|L2-2|T1|T2|T3
HA1|HA2|HA3|L2-3|T1|T2|T3
HA1|HA2|HA3|L2-4|T1|T2|T3
HB1|HB2|HB3|L1-1|T1|T2|T3
HB1|HB2|HB3|L1-2|T1|T2|T3
HB1|HB2|HB3|L1-3|T1|T2|T3
HB1|HB2|HB3|L1-4|T1|T2|T3
HB1|HB2|HB3|L2-1|T1|T2|T3
HB1|HB2|HB3|L2-2|T1|T2|T3
HB1|HB2|HB3|L2-3|T1|T2|T3
HB1|HB2|HA3|L2-4|T1|T2|T3
For someone with Perl Expertise - this should be pretty st forward script.
The script should be well documented and maintainable and needs to run on Linux. Your work should be guaranteed to work as per requirements :)
sanju,
what I get from your posting that you want to remove header and trailer from output and convert every other record line of input text file to couple of linea in the output text file.
If this is so, a solution that will run on Linux can be cooked up in around an hour (or lesser) assuming it's straightforward to identify the header and trailer records in input text file.
The solution can be easily implemented using either of bash/awk/perl scripting.