Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!umich!sharkey!sbcs!csserv2!gmarcus From: gmarcus@csserv2.ic.sunysb.edu (Glenn Marcus) Newsgroups: comp.binaries.ibm.pc.d Subject: RE: Is AWK up to this application? Message-ID: <1990Oct6.031701.20718@sbcs.sunysb.edu> Date: 6 Oct 90 03:17:01 GMT Sender: usenet@sbcs.sunysb.edu (Usenet poster) Organization: State University of New York at Stony Brook Lines: 28 Originator: gmarcus@csserv2 --------------------- CUT HERE ------------ CUT HERE -------------------- # TO RUN type at the command line ::>> # awk -f program.awk < data.yours # The following is a solution to matching variable field lengths in # a text file. Using the assumption that all fields will form columns, # one could extract a substring from the current line of the fixed # length of each field. # ie f1 starts at position 1 and continues for 19 characters # f2 starts at position 20 and continues for 24 characters # f3 exists at position 45 and continues for .. characters # you just need to determine all the boundaries for the columns and use # the AWK substr routine to extract that field. Then you can append it # altogether with the print command separated by newlines (\n) { f1 = substr($0,1,19); f2 = substr($0,21,24); # extract more fields here!! print f1 "\n" f2 "\n" # place more field names here as needed. } # Glenn Marcus gmarcus@ic.sunysb.edu # SUNY Stony Brook