Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site h-sc1.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!h-sc1!augart From: augart@h-sc1.UUCP (Steven Augart) Newsgroups: net.unix Subject: Re: Joining Textlines containing "Key: Text." Message-ID: <731@h-sc1.UUCP> Date: Fri, 8-Nov-85 12:36:12 EST Article-I.D.: h-sc1.731 Posted: Fri Nov 8 12:36:12 1985 Date-Received: Sun, 10-Nov-85 09:57:52 EST References: <429@unido.UUCP> <2155@umcp-cs.UUCP> Reply-To: swa@talcott.ARPA (Steven Augart) Distribution: net Organization: Harvard Univ. Science Center Lines: 13 Summary: bug In article <2155@umcp-cs.UUCP> chris@umcp-cs.UUCP (Chris Torek) writes: >Sounds like a problem for `awk'. Yes, but this script isn't quite what's required... Here's what I wrote for it ... awk '{ if ($1 != lastfield) { if (lastfield != "") printf "\n"; printf "%s :", lastfield = $1 } printf " %s", $3 } END {print}'This will write the requested output to stdout, and has the additional advantage that you can't run out of memory, whereas an internal array may overflow on a non-virtual-memory machine. This assumes that the file format given (with a space around the colon on both sides) is accurate. -- Steven Augart swa%tardis@harvard.harvard.edu