Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!cello!reed!d75!awdprime!nostromo.austin.ibm.com!daveb From: daveb@nostromo.austin.ibm.com (Dave Burton) Newsgroups: comp.unix.questions Subject: Re: First-line-only editing, part 2: Portable solutions Message-ID: <4158@awdprime.UUCP> Date: 8 Nov 90 17:56:49 GMT References: <16471:Oct2420:13:4390@kramden.acf.nyu.edu> <4031@awdprime.UUCP> <687@npdiss1.StPaul.NCR.COM> Sender: news@awdprime.UUCP Reply-To: daveb@bach.austin.ibm.com (Dave Burton) Organization: IBM AWD, Austin, TX Lines: 15 In article <687@npdiss1.StPaul.NCR.COM> mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) writes: |In article <4031@awdprime.UUCP> daveb@bach.austin.ibm.com (Dave Burton) writes: |:sed 's/.../.../;1q' < file > outfile | |Outfile then only contains first line of file, not the entire file |with the first line altered. Ouch! Well, it _does_ edit only the first line. :-) This line should work much better: sed '1s/.../.../' < file > outfile -- Dave Burton inet: daveb@bach.austin.ibm.com uucp: cs.utexas.edu!ibmchs!auschs!nostromo!daveb