The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading from a file and pass as variables and ignore # in the file konark Shell Programming and Scripting 4 11-07-2007 11:55 PM
Script for reading filelist and preparing param file. thebeginer UNIX for Dummies Questions & Answers 2 10-05-2007 01:19 PM
Reading and Writing file on LAN lucky001 High Level Programming 3 03-30-2007 11:16 AM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 01:25 AM
Reading specific contents from a file and appending it to another file dnicky Shell Programming and Scripting 5 10-04-2005 02:45 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-05-2007
Registered User
 

Join Date: Sep 2007
Posts: 3
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.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-05-2007
Registered User
 

Join Date: Oct 2007
Posts: 34
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
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0