First-line-only editing, part 2: Portable solutions
Dave Burton
daveb at nostromo.austin.ibm.com
Fri Oct 26 07:17:27 AEST 1990
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
More information about the Comp.unix.questions
mailing list