The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
combination of two commands nehaquick UNIX for Dummies Questions & Answers 3 02-01-2008 04:09 AM
Detecting a key combination mobile01 High Level Programming 11 12-22-2006 09:46 AM
shell help - file combination ting123 UNIX for Dummies Questions & Answers 4 06-29-2006 12:50 AM
Combination Of commands rahulrathod UNIX for Dummies Questions & Answers 2 12-14-2004 07:32 AM
Partition combination gardarm Filesystems, Disks and Memory 3 03-14-2002 07:35 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-13-2005
sickboy sickboy is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 62
awk and file combination

Hi there,
I have 3 files and i want to take different fields from each file and combine them in one. I would like to ask if somebody tell me how can I refer to each field of the different files to write an awk command.

I mean can I do sth like

awk '........... print $1.file1 $3.file2}' file1 file2 file3

??????

Cheers

Last edited by sickboy; 06-13-2005 at 04:59 PM..
  #2 (permalink)  
Old 06-13-2005
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,407
You may find it easier to use paste to join the files before using awk, e.g...
Code:
$ head [ab]file
==> afile <==
a1 a2 a3

==> bfile <==
b1 b2 b3

$ paste [ab]file | awk '{print $1, $6}'
a1 b3
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:25 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0