Page 1 of 1

shell script for changing the input file as output file

Posted: Tue Jun 03, 2008 10:58 am
by dodda
Hi all,
I had a small requirement in shell script.

In the Input directory iam having input file as RATE3092008033101.csv

I have to change the above file as PRICE3092008033101.csv and save the file in another directory.

RATE should be replaced by PRICE. And the input file names are not fixed , any new files may come in future.
Only RATE string is fixed, i have to replace with string PRICE.

please help me out in solving this one.

Thanks in advance.

Re: shell script for changing the input file as output file

Posted: Tue Jun 03, 2008 11:46 am
by Ultramundane
dodda wrote:Hi all,
I had a small requirement in shell script.

In the Input directory iam having input file as RATE3092008033101.csv

I have to change the above file as PRICE3092008033101.csv and save the file in another directory.

RATE should be replaced by PRICE. And the input file names are not fixed , any new files may come in future.
Only RATE string is fixed, i have to replace with string PRICE.

please help me out in solving this one.

Thanks in advance.
cp RATE3092008033101.csv $(echo /dirname/RATE3092008033101.csv | sed 's/RATE/PRICE/g')