Execute sequential files and store data in single file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execute sequential files and store data in single file
# 1  
Old 03-13-2013
Execute sequential files and store data in single file

1)In a particualr path i have a set of inputfiles like
Code:
path:/defaultmis/MonthlyLoads/INFA_EXPORT_022013/map*

example:
1)map_de
2)map_cod
3)map_feg
........and so on
in above path there wil be nearly 15 to 20 files starting with map and in other path i have another file input file /tmp/CMB_DEFAULT/DITMGR_Synonyms.lst.

2)now i should run the script
Code:
sh impact_analysis.ksh $path/map_de /tmp/CMB/DITMGR_Synonyms.lst

.

3)when i run above scriptill get one output CSV file.

Like this i should run scrtipt for all files.Then i should consolidate all ouput data(CSV file) into one CSV file and log file should capture the row counts for all outputfiles.

I just tried to write code for above logic:
Code:
#!/usr/bin/sh
Scripts=/tmp/CMB_DEFAULT
logfile=/tmp/logfile/
cd  /defaultmis/MonthlyLoads/INFA_EXPORT_022013/
 ls map* > /defaultmis/MonthlyLoads/inputfiles
cd /defaultmis/MonthlyLoads/NEW_INFA_Exports
 ls map >> /defaultmis/MonthlyLoads/inputfiles
 while read line 
do
sh Impact_Analysis.ksh  $line /tmp/CMB_DEFAULT/DITMGR_Synonyms.lst >> MB_Project_Impactanalysis.csv
MB_Project_Impactanalysis.csv | wc -l  >>logfile

end


please help and correct me if i am wrong.



Last edited by Scrutinizer; 03-13-2013 at 10:42 AM.. Reason: code tags
# 2  
Old 03-13-2013
While your requirements are far from being clear (to me, that is), there's a few comments on your code snippet:

1) Use code tags!

2) Where do you read "line" from?
3) your Analysis script has the ksh extension. Are you sure you want to run it with sh?
4) Your wc -l line doesn't work as you typed it - make it wc -l filename
5) You don't need all that ls ... > redirection - make it for line in map*
# 3  
Old 03-13-2013
sorry for the confusion,please tell the code for my requirement which mentioned above.

dnt consider my code.
# 4  
Old 03-13-2013
Code:
logfile="/tmp/logfile"

for map_file in /defaultmis/MonthlyLoads/INFA_EXPORT_022013/map*
do
    ./Impact_Analysis.ksh "$map_file" "/tmp/CMB_DEFAULT/DITMGR_Synonyms.lst" >> MB_Project_Impactanalysis.csv
done

wc -l MB_Project_Impactanalysis.csv >> logfile

# 5  
Old 03-14-2013
thanks,its working fine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to merge the multiple data files as a single file?

Hi Experts, I have created multiple scripts and send the output to new file, getting this output to my mailbox on daily basis. I would like to send the all outputs to a single file, need to merge all file outputs on a single file. For example, Created script for df -h > df.doc grep... (7 Replies)
Discussion started by: seenuvasan1985
7 Replies

2. Shell Programming and Scripting

How to store the file name in a single line??

hi, i have a variable, in which i am storing the file names that are present in the current directory. $ls -1 s1.txt s2.txt s3.txt $FILES=`ls -ltr | grep "^-" | awk '{print $NF}'` $echo $FILES s1.txt s2.txt s3.txt i want to store the files names in a single line in the variable... (7 Replies)
Discussion started by: Little
7 Replies

3. Shell Programming and Scripting

Help me pls : splitting single file in unix into different files based on data

I have a file in unix with sample data as follows : -------------------------------------------------------------- -------------------------------------------------------------- {30001002|XXparameter|Layout|$ I want this file to be splitted into different files and corresponding to the sample... (54 Replies)
Discussion started by: Ravindra Swan
54 Replies

4. Programming

How to extract data from CVS log files and store it in database ?

Am currently working on CVS projects .. I have generated the cvs log file which is in the RCS file format . .I want to extract file path ,total revision ,date ,author and message from that file . .I want a program in java which would extract the data from cvs log file. .Pls help me out.. My... (0 Replies)
Discussion started by: EVERSOFT
0 Replies

5. Shell Programming and Scripting

Parse a single line file and store value.

I have a single line file like this : Average Fragmentation Quotient : 3.084121 Now I want to store the value which comes after ":" i,e 3.084121 into a variable. And if this variable crosses above 6 i want to call another script... can any one help me on this... (7 Replies)
Discussion started by: Hyp_Todd
7 Replies

6. Programming

Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX

Writing a Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX I have over the years come across the same issue a couple of times, and it normally is that the read speed on SAN is absolutely atrocious when doing non-sequential I/O to the disks. Problem being of... (7 Replies)
Discussion started by: vrghost
7 Replies

7. Shell Programming and Scripting

Execute stored procedure through script in sybase database and store the output in a .csv file

Hi, I have a sybase stored procedure which takes two input parameters (start_date and end_date) and when it get executed, it gives few records as an output. I want to write a unix script (ksh) which login to the sybase database, then execute this stored procedure (takes the input parameter as... (8 Replies)
Discussion started by: amit.mathur08
8 Replies

8. Shell Programming and Scripting

How to sca a sequential file and fetch some substring data from it

Hi, I have a task where i need to scan second column of seuential file and fetch first 3 digits of that column For e.g. FOLLOWING IS THE SAMPLE FOR MY SEQUENTIAL FILE AU_ID ACCT_NUM CRNCY_CDE THHSBC001 30045678 THB THHSBC001 10154267 THB THHSBC001 ... (2 Replies)
Discussion started by: manmeet
2 Replies

9. Shell Programming and Scripting

How to store Data in a File

I want to read a data from a read command and store it in a file...... Plz send me how I can do that Ex: read val and I want to store this val in a file called temp. (2 Replies)
Discussion started by: krishna_sicsr
2 Replies

10. Programming

Reading special characters while converting sequential file to line sequential

We have to convert a sequential file to a 80 char line sequential file (HP UX platform).The sequential file contains special characters. which after conversion of the file to line sequential are getting coverted into "new line" or "tab" and file is getting distorted. Is there any way to read these... (2 Replies)
Discussion started by: Rajeshsu
2 Replies
Login or Register to Ask a Question