[wellylug] simple super basic bash question

Brent Wood pcreso at pcreso.com
Mon Dec 20 23:32:57 NZDT 2004


--- Geraint Jones <g.jones at french-maid.co.nz> wrote:

>  echo `cat file1` `cat file2` > file3

OK if file1 & file2 only have one line in each. Otherwise try

 paste -d " " <file1> <file2> 


paste writes corresponding lines from file1 & file2 to stdout, separated by a
tab. The -d option allows you to specify the delimiter to use, in the example
above, use a space instead of a tab.

Cheers,
  
  Brent

> 
> ________________________________
> 
> From: wellylug-admin at lists.wellylug.org.nz on behalf of Mark Signal
> Sent: Mon 20/12/2004 9:53 PM
> To: Wellylug
> Subject: [wellylug] simple super basic bash question
> 
> 
> 
> if  file1 contains "hello" and file2 contains "goodbye" and I    'cat
> file1 file2 > file3'  then
> file3 contains 2 lines:
> hello
> goodbye
> 
> how do I do this so that file3 contains the contents of file1 and file2
> on one line:
> hello goodbye
> 




More information about the wellylug mailing list