Path: utzoo!attcan!uunet!ncrlnk!ncrstp!npdiss1!mercer From: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) Newsgroups: comp.unix.questions Subject: Re: First-line-only editing, part 2: Portable solutions Message-ID: <687@npdiss1.StPaul.NCR.COM> Date: 30 Oct 90 16:57:45 GMT References: <16471:Oct2420:13:4390@kramden.acf.nyu.edu> <4031@awdprime.UUCP> Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) Organization: StPaul Lines: 24 In article <4031@awdprime.UUCP> daveb@bach.austin.ibm.com (Dave Burton) writes: :In article <16471:Oct2420:13:4390@kramden.acf.nyu.edu> brnstnd@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@nostromo.austin.ibm.com | but you can't make him think." :cs.utexas.edu!ibmchs!nostromo!daveb | -- stevea@i88.isc.com Outfile then only contains first line of file, not the entire file with the first line altered.