Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Want to thank those people who have made this forum such a valuable place to visit each day..."

Geography

Where in the world do Tek-Tips members come from?
chipmate (TechnicalUser)
10 Dec 10 3:38
Hi

After run I do get 5 or 6 file every day ,I have a fixed file1 also ,What I want that awk will read file one and get matched line from other file and write result in next column --
like -RESULT
-----------------file1--file2----file 3---file4--------------------------
app man TRUE FALSE TRUE TRUE
mo mi FALSE FALSE FALSE FALSE
ch chu TRUE TRUE TRUE TRUE
tik tok TRUE TRUE TRUE TRUE

file 1--

app man
mo mi
ch chu
tik tok

file 2 --Diffrent order
app man TRUE
tik tok TRUE
mo mi FALSE
ch chu TRUE

file 3- diffrent order
app man FALSE
tik tok FALSE
mo mi TRUE
ch chu TRUE

file 4- diffrent order
app man TRUE
tik tok FALSE
mo mi TRUE
ch chu TRUE


Thanks in advance
Chipmate
 
p5wizard (IS/IT--Management)
10 Dec 10 5:36
Quick & dirty (and doesn't give the ouput in the order that the records appear in file1):

CODE

for file in file1 file2 file3 file4
do
  sort -o $file $file
done

paste file1 file2 file3 file4|awk '{print $1,$2,$5,$8,$11}'

But I'm sure someone will come up with an all-awk (array) solution.

HTH,

p5wizard

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close