Xref: utzoo comp.binaries.ibm.pc.d:9749 comp.sys.ibm.pc.misc:2348 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!agate!shelby!rutgers!att!cbnewsh!jlp From: jlp@cbnewsh.att.com (jon.peticolas) Newsgroups: comp.binaries.ibm.pc.d,comp.sys.ibm.pc.misc Subject: Re: Is AWK up to this application? Message-ID: <1990Oct5.163904.7824@cbnewsh.att.com> Date: 5 Oct 90 16:39:04 GMT References: <1661@wjvax.UUCP> Organization: AT&T Bell Laboratories Lines: 47 From article <1661@wjvax.UUCP>, by mario@wjvax.UUCP (Mario Dona): > Does anyone know of a way of extracting information from a text file > which contains variable length fields, and outputting it in a different > format? For example, I have a text file which contains names and > addresses as shown below. > John Doe 1563 Meadow Lane San Jose, CA 94325 more stuff ---> > John Smith 345 N. First Street Oakland, CA 94356 more stuff ---> > Henry & Martha Coe 4567 Poplar Ave. Newark, NJ 78389 more stuff---> > ^ ^ ^ > | | | > | | |_____ column 45 > | |______________________________ column 20 > |_________________________________________________ column 1 > I want to extract the names and addresses and output it in the following > format: > John Doe > 1563 Meadow Lane > San Jose, CA 94325 > John Smith > 245 N. First Street > Oakland, CA 94356 > Henry & Martha Coe > 4567 Poplar Ave. > Newark, NJ 7838 > Can this be done using AWK, and if so how? Or is there some other way? Yes { print substr($0,1,19); print substr($0,20,24); print substr($0,45); } Provided that all of the whitespace made up of space characters (no tabs). -Jon There's a time and place for spontaneity.