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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

CSH & awk two files > one file

Reply to Message Icon

Name: amaussa
Date: January 15, 2005 at 02:39:23 Pacific
OS: SUN
CPU/Ram: -
Comment:

I have two files:
- EQUI containing two columns old_code and new_code
- NAME containing a list of article with the old ones
I code seek how to carry out a Unix order to replace in the file NAME all the old_code by their equivalents defini in file EQUI.
tancks




Sponsored Link
Ads by Google

Response Number 1
Name: vgersh99
Date: January 16, 2005 at 08:19:07 Pacific
Reply:

pls post samples input files and a desired output.


0

Response Number 2
Name: vgersh99
Date: January 18, 2005 at 07:23:00 Pacific
Reply:


nawk -f ama.awk equiv.txt name.txt

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


0

Response Number 3
Name: Sakthi
Date: January 25, 2005 at 02:08:19 Pacific
Reply:

make use of paste command
paste file1 file2


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: CSH & awk two files > one file

CSH & awk two files > one file www.computing.net/answers/unix/csh-amp-awk-two-files-one-file/6798.html

Awk from two files into one file www.computing.net/answers/unix/awk-from-two-files-into-one-file/6194.html

To combine two files to one file www.computing.net/answers/unix/to-combine-two-files-to-one-file/7204.html