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 offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 27 May 2018, 11:49 AM EDT
Location: San Jose, CA, USA
Posts: 11,312
Thanks: 639
Thanked 3,936 Times in 3,367 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.