Reading a file and writing the file name to a param file.

Hi All,

Not sure if this would be in a dummies sectiin or advanced. I'm looking for a script if someone has doen something like this.

I have list of files -
adc_earnedpoints.20070630.txt
adc_earnedpoints.20070707.txt
adc_earnedpoints.20070714.txt
adc_earnedpoints.20070721.txt
adc_earnedpoints.20070728.txt
adc_earnedpoints.20070804.txt
adc_earnedpoints.20070811.txt
adc_earnedpoints.20070818.txt

I need to process these files using informatica process and write the content of the file to a DB table. While writing the file to db i need to capture the date from the file name and pass to a parameter file in unix and use the parameter file to write the data value in db. And also i need to process 1 file for each run so that i can grab teh date from teh file name and capture in a param file which will be used by Informatica process. Something like this -

file processing adc_earnedpoints.20070630.txt should be renamed to generic file adc_earnedpoints.txt and the date 20070630 should be wrriten to a param file with values -
s_load_earned_points (informatica session)
$$process_date=20070630 (which will be called in teh informatica mapping.

And similarly process teh rest of files.

Has anyone ever done something like this before, if so could you please provide teh script for this.

Any help is greatly & kindly appreciated.

Regards,
Beginer.

not sure what exactly are you looking for..if i understood correctly..u may want to do something like this-

for file in adc_earnedpoints*.txt
do
datestr=`echo $file | cut -d. -f2`
new=`echo $file | cut -d. -f1,3`

mv $file $new
#call informatica session with the datestr
done

cheers,
Devaraj Takhellambam