[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using AWK to copy files based on a mapping file
From: |
Sharuzzaman Ahmat Raslan |
Subject: |
Re: Using AWK to copy files based on a mapping file |
Date: |
Fri, 14 Jan 2011 12:24:04 +0800 |
Hi Badri,
If you can show how the content of the map file look like, I might be able
to create a solution for you.
On Fri, Jan 14, 2011 at 12:15 PM, Badri <address@hidden> wrote:
> 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
>
--
Sharuzzaman Ahmat Raslan