I need to build a wrapper script which will be passing the loading date and the data file name (provides option to the user to load a single data file or load all the data files) to the actual loader data_load.ksh to load in the database.
1. I want to execute the loader script data_load.ksh one after another (one at a time), that is once data_load.ksh File1 finishes data_load.ksh File2 will start so and so forth. Loading a single file is not a concern. For full/all data files load, I am reading the data file names from a text file 'file.list' and executing the data_load.ksh from a for loop with an ampersand (sending to the background) & wait signal for each file, hoping that wait command will meet my expectation. Is there any alternate way of doing this?
2. My date validate part is not quite working as expected. Technically 20141411 date format should be incorrect but according to my date validation check echo ${dt}|grep -E -q '^201[1-9][01][0-9][0-3][0-9]$' it shows correct. How can I fix the MM part, so that any number other than 1 to 12 determines incorrect format?
3. In my fn_SingleFileLoad function, file name is passed through the input prompt. The input can not be more than one file name (i.e the program should send error or exit if someone provides more than one file. Example of an input: FileA FileB). Can someone please share some expertise on this part?
I would like to thank you all in advance for sharing your suggestions or help here.
Try changing:
to:
to allow months 01-12 and days 01-31. This will still incorrectly allow some days in short months (e.g., 20140230 and 20140431), but it won't allow days 00 and 32-39 nor months 00 and 13-19.
And, assuming that .${HOME}/dbscripts/data_load.ksh uses quotes properly and yields an appropriate diagnostic if its file operand isn't found, change:
to:
although I'm guessing that what you really wanted is:
(Note the space added between the . and the$.)
Thank you Don for your suggestions and reply. Yes, ill be run the files/directories in the each steps.
For #2 dateformat: It worked to resolve the month MM format. If I do not get solutions from anyone else for the shorter months, ill continue with the limitations.
to allow months 01-12 and days 01-31. This will still incorrectly allow some days in short months (e.g., 20140230 and 20140431), but it won't allow days 00 and 32-39 nor months 00 and 13-19.
For#3 - I need to allow only one file as an input and would like to through error & exit if multiple file names are entered. I am still not able figure that out. Any thoughts or suggestions will be great help.
Once you have the format assured, you can verify the date with the cal command.
NB I have removed the double [ from the ERE that would allow a [ character in the input.
This User Gave Thanks to MadeInGermany For This Post:
Now that I am close to my achievement, any idea how can I ensure #3 challenge.
For#3 - I need to allow only one file as an input and would like to through error & exit if multiple file names are entered. I am still not able figure that out. Any thoughts or suggestions will be great help.
Since spaces, tabs, and filename pattern special characters are all legal characters in a filename, finding out if a string matches more than one filename is not as easy as it sounds. But trying to figure out that you have more than one filename doesn't make any sense; why not just verify that what you were given names an existing file? If you just want to know if $file does not expand to the name of a file of any type:
If you only want regular files, change -e to -f.
----------
And, I forgot to mention that you also need to change:
to:
Last edited by Don Cragun; 05-12-2014 at 03:34 AM..
Reason: Add additional required fix.
This User Gave Thanks to Don Cragun For This Post:
Hello all ,
i need some help asap
i have a program that keeps killing the machine
when i did google searches and 2 days later i ran strace
it seems the programm keeps making a system call to gettimeofday
to i guess increment a counter ?
gettimeofday({1347986584, 464904}, NULL) = 0... (6 Replies)
Hi friends,
i am working in ksh88. i am running the follwing wapper script in background to run two jobs parallely((eg nohup wrapper.ksh &)::
wrapper.ksh
########################
#!/bin/ksh
nohup ./pii_insert.ksh /nsing83/p2/test &
nohup ./pii_update.ksh... (1 Reply)
Hello,
My requirement is based on Oracle where we run a perl script and it asked some questions.I want to write a wrapper which will answer all these questions.
How is it possible.
Thanks (16 Replies)
Hi,
I am writing a wrapper script(wrap_script.sh) to one of the main scripts (main_script.sh)
The main script is executed as following:
./main_script.sh <LIST> <STARTDATE> <ENDDATE>
looks for a parameter which is a LIST(consists of different list names that need to be processed), START/END... (0 Replies)
I have this a code that I got help with for another task. I since tried to modify it to work on this task.
I need someones expertise to modify it slightly and I am not sure where to start or yet fully understand the logic.
I am trying to get a script to read my m-names.txt which has lots... (19 Replies)
Hi,
I am in need of way to facilitate this senerio in a perl script.
I have CLI ( command line interface) which I run like so:
kip-tepltist -u Xxx -p Xxx
Which produces tones of names from each template it found:
194Iselin-NJ
33-IDFLB-North-611-Woodward-8600 ... (5 Replies)
Hello,
I have the below wrapper script:
#!/usr/bin/perl -w
if ($^O eq 'MSWin32' ) {
$subnet = 'c:\path\to\subnet.txt';
}
else {
$subnet = '/opt/qip/wrapper-del-sub';
}
open FH1, 'jj-deleted-subnets.txt' or die "Can't open 'jj-deleted-subnets.txt'
... (0 Replies)
Hi Guys, I am trying write a wrapper script but I don't have any idea. I have 4 different korn shell scripts and all of them needs some parameters from command line (positional parameter). My script cant be interactive because its supposed to be automated. I am confused how can I write a wrapper... (6 Replies)
hi guys,
I have a requirement to run a script 4 times with different parameter values.
the 4 jobs have to run parallely which actually access different data of same table and deletes.
how can i achieve this.................?
Thanks in advance (1 Reply)