Passing parameter from one file to shell script

Hi All,

I have a 2 files. File1 i am generating using an ETL tool, which is a comman seperated delimited file which contains country code & load date.
everytime, this country code will be updated from a table. It might be AB or BA & ld_date will be for which date we need to load the file.

In file2.sh script which is doing feed validation test for the feed file, i need to pass this country code & load date.

File1

COUNTRYCODE,LD_DATE
AB,20081210

File2.sh

echo $1 $2

Can someone tell me if it is possible to pass in this manner. Because i need to call File2.sh thru ETL tool. so i cannot manually change the parameter daily. I need to pass this parameter dynamically for each run.

Take a look at the following. I inserted the "2*" into the script just to verify/show what was doing the echo.

> cat file1
COUNTRYCODE,LD_DATE
AB,20081210

> cat file2.sh
echo "2*" $1 $2

> while read var1 var2; do file2.sh $var1 $var2; done <file1
2* COUNTRYCODE,LD_DATE
2* AB,20081210

Hi joeyg,

Thanks for your input.

But what i want is... it must be like...

./file2.sh AB 20081210

while executing above code, i am not getting what i wanted.

Thank for ur help

What are you getting for output?
It looks like it should be fine.

Hi Joeyg,

I found the answer.

file1

COUNTRYCODE,LD_DATE
AB,20081210

file2.sh

#!/bin/sh
var1=`sed '1d' File1 | cut -d, -f1`
var2=`sed '1d' File1 | cut -d, -f1`

echo $var1
echo $var2

OK, I see what you are doing... eliminating the header row with the sed command.
Although I think your var2 should be a cut with an f2 -- you want the second entry on that line. Right?

yes, u r right sorry for typo.....

I would have used
tail +2 file1

to skip the first row of a file