[Techtalk] copy file headers...

Kai MacTane kmactane at GothPunk.com
Fri May 17 11:32:01 EST 2002


At 5/17/02 07:58 AM , Jenn Vesperman wrote:

>1. Use 'head' to grab x lines from file 1.
>2. Use 'tail' to grab from line x to end of file 2.
>3. Use 'cat' or '>>' or some such to prepend the results of step 1 to
>the results of step 2.
>
>There may be a semi-documented feature of head or tail that makes this
>even easier.

Well, 'head -x filename' is pretty well known. Most Linux versions of tail 
will take 'tail +x filename' and give you everything from line x of file 
filename, on to the end of the file. (This trick not guaranteed for other 
Unices; check your 'man tail' before relying on this behavior.)

                                                 --Kai MacTane
----------------------------------------------------------------------
"But every night I burn,/Every night I call your name.
  Every night I burn,/Every night I fall again..."
                                                 --The Cure,
                                                  "Burn"




More information about the Techtalk mailing list