[CS-FSLUG] Merging Files

Frank Bax fbax at sympatico.ca
Sun Nov 28 07:59:42 CST 2004


At 07:24 PM 11/27/04, Brian Derr wrote:

>On Fri, Nov 19, 2004 at 07:15:13PM -0500, Don Parris wrote:
> > I've got a friend that wants to take Line # 1 from File A and Line #1
> > from File B, and merge them into 2 lines in File C.  What's the best
> > tool to do this?
>
>Did you ever figure this out?  If not here is my stab at it.  Using your
>basic UNIX tools we have 'head' at our disposal.  If all you want is the
>first line from each file into a third file it will look something like
>this.
>
>    head -n1 file1 > file3; head -n1 file2 >> file3

Same thing with slightly different syntax:

         ( head -n1 file1 ; head -n1 file2 ) > file3





More information about the Christiansource mailing list