Unix/Linux Go Back    



Replacing first field of file2 with the second filed of file1 for matching cases

Shell Programming and Scripting




Kindly Note - This is a Single User Post by Forum Member Don Cragun Regarding:
Replacing first field of file2 with the second filed of file1 for matching cases.
Please Follow The Primary Link Above to View the Full Discussion.

   
Old Unix and Linux 11-06-2014   -   Original Discussion by ailnilanjan
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is online now Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 23 February 2018, 3:14 PM EST
Location: San Jose, CA, USA
Posts: 11,085
Thanks: 618
Thanked 3,864 Times in 3,306 Posts
I misread what you were trying to do. To get the output you wanted using my suggestion, you'd need to change the line:


Code:
	$2 = x[$1]

to:


Code:
	$1 = x[$1]

In the future, please show us a sample of the output you're trying to produce as well as samples of your input files.