[CS-FSLUG] Merging Files

Brian Derr bderr at myrealbox.com
Sat Nov 27 18:24:35 CST 2004


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

This will create file3 with the first line of file1 and then append the
first line of file2 to the end of file3.

Easy as pie!  :-)

Brian

-- 
The just man walketh in his integrity:
his children are blessed after him.  -- Proverbs 20:7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://ofb.biz/pipermail/christiansource_ofb.biz/attachments/20041127/879988a0/attachment.sig>


More information about the Christiansource mailing list