Datafile conversion with AWK !

Cliff Manis cmanis@csoftec root at csoftec.csf.com
Thu Dec 14 10:53:07 AEST 1989


I am needing help with data conversion, and would appreciate help 
in AWK or SED and/or awk & sed.   Or whatever....

While attempting to convert thie data for sometime with 'awk', I have
learned a lot, but still need some help with this one.

(here is the ASCII datafile I have)

AA1|name1|4you|ABC Co|3|56|a|bbb|c|d|eeee|fff|g|1|
AA1|name1|4you|5th ST||||||||||2|
AA1|name1|4you|Go4it, TX||||||||||3|
ZZ1|name2|5ght|SED Co.|4|88|b|ccc|c|d|eee2|ff2|h|1|
JJ1|name3|6ghi|AWK Inc.|4|98|c|ddd|e|f|gggg|ff3|i|1|
JJ1|name3|6ghi|2nd St||||||||||2|
JJ1|name3|6ghi|POB 34||||||||||3|
JJ1|name3|6ghi|Town, USA||||||||||4|
BB1|name4|7mob|B H Co|2|56|d|eee|f|g|hhhh|ii4|j|1|
BB1|name4|7mob|Athens, TN||||||||||2|

Please note that some records have one line to 4 lines of data, and
the address field is field four.  The last field is the sub-record number.

(and this is the datafile configuration which I need from the data above)

AA1|name1|4you|ABC Co|5th ST|Go4it, TX||3|56|a|bbb|c|d|eeee|fff|g|1
ZZ1|name2|5ght|SED Co.||||4|88|b|ccc|c|d|eee2|ff2|h|1
JJ1|name3|6ghi|AWK Inc.|2nd St|POB 34|Town, USA|4|98|c|ddd|e|f|gggg|ff3|i|1
BB1|name4|7mob|B H Co|Athens, TN|||2|56|d|eee|f|g|hhhh|ii4|j|1

Thanks in advance for any help sent to me or over the net.  As anyone can 
readily see, the top datafile is a BIG waste of space.....cliff
     ______________________________________________________ 
    +      Unix & Xenix today for a better tommorrow!      +
    +      Cliff Manis        ARPA: hcscm at afbs.af.mil      +
    +         INTERNET: cmanis at csoftec.csf.com             +
    +   UUCP: {dpmizar|texbell|swrinde}!csoftec!cmanis     +
-



More information about the Comp.unix.questions mailing list