Xref: utzoo comp.unix.questions:18421 comp.unix.wizards:19754 comp.sources.wanted:9757 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!dpmizar!csoftec!root From: root@csoftec.csf.com (Cliff Manis (cmanis@csoftec)) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.sources.wanted Subject: Datafile conversion with AWK ! Keywords: datafile conversion awk sed Message-ID: <539@csoftec.csf.com> Date: 13 Dec 89 23:53:07 GMT Organization: CompSofTech Co., POB 33937, San Antonio, TX 78265 Lines: 37 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@afbs.af.mil + + INTERNET: cmanis@csoftec.csf.com + + UUCP: {dpmizar|texbell|swrinde}!csoftec!cmanis + -