[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using AWK to copy files based on a mapping file
From: |
Badri |
Subject: |
Using AWK to copy files based on a mapping file |
Date: |
Thu, 13 Jan 2011 23:15:00 -0500 |
Dear All
This is not a bug report, but a help request.
I'm a new user of AWK and have to deal with a particular situation using
AWK.
I have N region files with names reg1_xyz.txt, reg2_xyz.txt and so on. And
I also have C countries which are mapped to these N regions. I have a maping
file that has country codes mapped to region codes, say map.txt.
Now I want to generate files ctry1_xyz.txt, ctry2_xyz.txt and so on, based
on this mapping file, by merely copying and renaming the region files for
the countries, based on this mapping.
For example, if I have North American region file as NAM_xyz.txt and NAM is
mapped to USA, Mexico and Canada, I need usa_xyz.txt, mex_xyz.txt and
can_xyz.txt - all merely copies of NAM_xyz.txt, but renamed according to the
country names appearing in the mapping file.
Please let me know some ways I can do this in AWK.
Thanks and regards
Badri
- Using AWK to copy files based on a mapping file,
Badri <=