edit first line of long file
Kartik Subbarao
subbarao at beam.Princeton.EDU
Wed Oct 24 06:38:05 AEST 1990
In article <27338 at shamash.cdc.com> ddh at 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 at silvertone.Princeton.EDU (NeXT mail) -|
SUBBARAO at PUCC.BITNET - Bitnet
More information about the Comp.unix.questions
mailing list