[CS-FSLUG] Merging Files
Don Parris
gnumathetes at gmail.com
Sat Nov 27 20:23:51 CST 2004
On Sat, 27 Nov 2004 19:24:35 -0500, Brian Derr <bderr at myrealbox.com> 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
>
> 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
>
Actually, I passed the info on to the guy, but I don't know if he
accomplished anything. I'll have to forward this on to him. I've
actually never heard of "head". Of course, I have had much reason to
use the text/file manipulation tools in any system. About the only
time I need anything like that, the text editor I'm using will do the
trick nicely - especially jEdit.
Don
--
DC Parris GNU Evangelist
http://matheteuo.org/
gnumathetes at gmail.com
Free software is like God's love -
you can share it with anyone anywhere anytime!
More information about the Christiansource
mailing list