Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make 4-column

Status
Not open for further replies.

ovince

Programmer
Feb 27, 2007
55
FR
hi,

I have files with 2 columns of data

g1.dat
f1.dat
g2.dat
f2.dat
...

I know how to join g1.dat and f1.dat into one file with 4 columns. I do that like

awk 'FNR==NR {a[FNR]=$0;next}{print $1, $2, a[FNR]}' f1.dat g1.dat > f1g1.dat

I would like to do this in loop for each pair similarly like for f1.dat and g1.dat. I made a list with file names to be sure what I am joining like:

g1.dat f1.dat
g2.dat f2.dat
g3.dat f3.dat
....

How to use this list to join files in the loop?

thanks
oliver
 
paste is ok but after pasting I can not read in the obtained file as an ASCII with some Windows programs since it put some characters in the file. unix2dos does not help
 
They are only tabs? You could use paste -d ' ' file1 file2 to specify space as a delimiter instead.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top