Computing.Net > Forums > Unix > CSH & awk two files > one file

CSH & awk two files > one file

Reply to Message Icon

Original Message
Name: amaussa
Date: March 26, 2005 at 02:21:47 Pacific
Subject: CSH & awk two files > one file
OS: SOLARIS
Comment:

nawk -f ama.awk equiv.txt name.txt
#---------- ama.awk ------------------
FNR == NR {
arr[$1]=$2;
next;
}
{
if ( $2 in arr )
$2 = arr[$2];
print;
}
---------

if the order of the columns changes in the Name file how to make to modify the program. file EQUI.txt contains
old code new code
11125879 211125648
13562452 311115642
the file NAME.txt contains the old code which can be in column 1, 2 or 3..


Report Offensive Message For Removal


Response Number 1
Name: amaussa
Date: April 4, 2005 at 08:35:58 Pacific
Subject: CSH & awk two files > one file
Reply: (edit)

could you help me to undestand how works the programme ama.awk line by line.
If I have another file name.txt with three columm and I want to compare the columm one of equi.txt with the columm tree of name.txt
is it possible ?


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: CSH & awk two files > one file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge