Computing.Net > Forums > Unix > Combine files using awk

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Combine files using awk

Reply to Message Icon

Original Message
Name: tasdemir
Date: December 20, 2006 at 09:57:34 Pacific
Subject: Combine files using awk
OS: unix
CPU/Ram: NA
Manufacturer/Model: NA
Comment:

I have several files in the following format:
(i will show two examples and the final format i need)

file1:

length mm 100
length cm 100
length km 333
width mm 122
width cm 323
width km 112

file2:

length mm 10
length cm 10
length km 33
width mm 22
width cm 23
width km 11

combined file:

length mm 100 10
length cm 100 10
length km 333 33
width mm 122 22
width cm 323 23
width km 112 11

thanks in advance


kadim tasdemir


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: December 20, 2006 at 10:17:37 Pacific
Reply: (edit)

I see no reason to use awk:

#!/bin/ksh

while read f1 f2 f3
do
echo "$f3"
done < file2|paste -d " " file1 -



Report Offensive Follow Up For Removal

Response Number 2
Name: tasdemir
Date: December 20, 2006 at 11:23:09 Pacific
Reply: (edit)

thanks, it helped.

kadim tasdemir


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software