From: laredotornado on
Hi,

I have one CSV file with three columns of data ...

"COL1","Col2","col3"

and I have another file with only a single column of data.

col4

How do I create a combined file where each row of the second file is
appended onto each row of the first file, forming something like

"COL1","Col2","col3",col4

? I'm using Mac 10.5.6. Thanks, - Dave
From: pk on
laredotornado wrote:

> I have one CSV file with three columns of data ...
>
> "COL1","Col2","col3"
>
> and I have another file with only a single column of data.
>
> col4
>
> How do I create a combined file where each row of the second file is
> appended onto each row of the first file, forming something like
>
> "COL1","Col2","col3",col4
>
> ? I'm using Mac 10.5.6. Thanks, - Dave

man paste

eg,

paste -d, file1 file2
From: Hai Vu on
On Feb 22, 8:21 am, laredotornado <laredotorn...(a)zipmail.com> wrote:
> Hi,
>
> I have one CSV file with three columns of data ...
>
> "COL1","Col2","col3"
>
> and I have another file with only a single column of data.
>
> col4
>
> How do I create a combined file where each row of the second file is
> appended onto each row of the first file, forming something like
>
> "COL1","Col2","col3",col4
>
> ?  I'm using Mac 10.5.6.  Thanks, - Dave

Mac OS X (and possibly Linux) has a utility called 'lam' for this
purpose:

$ cat data1.txt
first,id,shell
hai,405,bash
john,406,bash
randy,407,csh

$ cat data2.txt
alias
haiv
johnk
randya

$ lam data1.txt -s ',' data2.txt
first,id,shell,alias
hai,405,bash,haiv
john,406,bash,johnk
randy,407,csh,randya