First-line-only editing, part 2: Portable solutions
Dan Mercer
mercer at npdiss1.StPaul.NCR.COM
Wed Oct 31 03:57:45 AEST 1990
In article <4031 at awdprime.UUCP> daveb at bach.austin.ibm.com (Dave Burton) writes:
:In article <16471:Oct2420:13:4390 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
:|X-Original-Subject: Re: edit first line of long file
:|As shown in my previous message, sed is much slower than a head-sed-cat
:|combination on a particular 300K file. ...
:
:Not (necessarily) so.
:
:| So the fastest portable solution I've seen is
:| head -1 file | sed 's/.../.../'; tail +2 file
:
:Try:
:
:sed 's/.../.../;1q' < file > outfile
:
:Nuff said.
:--
:Dave Burton | "You can lead a moron to water,
:daveb at nostromo.austin.ibm.com | but you can't make him think."
:cs.utexas.edu!ibmchs!nostromo!daveb | -- stevea at i88.isc.com
Outfile then only contains first line of file, not the entire file
with the first line altered.
More information about the Comp.unix.questions
mailing list