The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-03-2009
creamcheese creamcheese is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 4
appending several columns with awk and paste

Hello,

I am trying to solve for a couple of hours now the following problem:

I have n files and would like to add the third column of each file to a new file:

temp1.txt

1 2 3
1 2 3
1 2 3

temp2.txt

1 2 4
1 2 4
1 2 4
1 2 4

temp3.txt

1 2 5
1 2 5
1 2 5

and so on....

The desired output would be:

3 4 5 ..
3 4 5 ..
3 4 5 ..

I thought I managed to get the two columns of each file into a new file with awk and with paste -d, but I havent found a away to combine the two.

Any hints would be greatly appreciated!

Thanks!
J