Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!princeton!beam!subbarao From: subbarao@beam.Princeton.EDU (Kartik Subbarao) Newsgroups: comp.unix.questions Subject: Re: edit first line of long file Message-ID: <3535@idunno.Princeton.EDU> Date: 23 Oct 90 20:38:05 GMT References: <27338@shamash.cdc.com> Sender: news@idunno.Princeton.EDU Lines: 33 In article <27338@shamash.cdc.com> ddh@dash@udev.cdc.com (Dan Horsfall) writes: >I've seen this done somewhere, but can't for the life of me >remember what the trick was, or where I saw it... > >I have a long text file. I want to pass the first line through a >short sed script, and ignore(i.e., pass unscathed) the rest of the >file. > >Plan A: pass the whole file thru sed, qualifing the search string >as "1s/.../.../"; sed will look at each line of the file. > >Plan B: pull off the first line with "line", pass it to sed, and >somehow magically get lines 2-n sent to stdout with cat. I'm sure >I've seen it done, with some combination of redirection, parentheses, >pipes, etc., but can't reproduce it from dim menory. Hmm - I see what you mean, but I don't think that it involves lots of ( )'s and the like. You can get every line after the first with tail +2 filename. So I guess you'd might want to head -1 filename | sed whatever, then tail +2 filename >> outputfile. As to the speed of this, I'm not sure how fast it would be. -Kartik (I need a new .signature -- any suggestions?) subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet kartik@silvertone.Princeton.EDU (NeXT mail) -| SUBBARAO@PUCC.BITNET - Bitnet