1) I have to create 3 scripts which create different output files. Script one creates datafiles, script2 creates control files and script3 creates flg files. The business wants the same timestamp to be attached to all the files created by these scripts.
Script1- Create data files - Data files name format-> xxxx.01122010_223048.dat
Script2- Create Control files - Control files name format -> yyyy.01122010_223048.ctl
Script3 - Create flg files- flg files name format-> zzzz.01122010_223048.flg
How can I define a variable which gives the timestamp once and then can be used in all the three scripts?
These scripts are called from an intial script as follows
./$POS_SCRIPT/dw_postodw_pharmacysplit.ksh
./$POS_SCRIPT/dw_postodw_controlfile.ksh
./$POS_SCRIPT/dw_postodw_cpfiles.ksh
How do I check the return status of the previous script before starting the next If the return status is not success, I need to write that to a logfile and exit in the succeeding scripts.
-----------------------------------------
2)I have an input file(named common_files) which contains a set of table names. I need to search the current directory to check if the filename contain the table names from the input file. Move all those files to another directory.
For example the filename is of the format XXXX_<tablename>_timestamp. If the tablename matches from input file, those files should be moved to another directory.
Can I do the grep and move with a single command in my scripting? I got stuckup as below.
--------------------------------------
3)I have another input file which contains a list of pharmacyids(This is an input file contains around 450 pharmacy ids). I need to search a set of flatfiles(119 files) to split them based on the 450 ids.Means each of these 119 files need to be split into 450 files based on the presence of the pharmacy ids. The postion of pharmacy id in the 119 files vary from file
to file.I need to search for the id as a whole word and copy the matching lines to outputfiles. So a maximum of 119 * 450 output files may be generated.
INPUT FILE -> a file contains a list of 450 pharmacyids
flat FILE -> 119 files whcih may conatin the 450 pharmacy ids , but position of ids vary
OUTPUT FILES->the files created from flat files by copying the matching lines for each id.
The below one is my script. Can somebody review and give suggestions on logic and performance?(I heard 'cat' and grep used together will slow down the performance especially this may be executed 119 * 450 times).
Those are some long questions
I'll attempt the first. It sounds fairly simple.
You need to get the current time stamp in your initial script and pass that as an argument to your 3 scripts.
In each of these 3 scripts, you would write:
That should give you the common time stamp throughout all 3 scripts.
Regarding your second sub question, error handling should be done within the files itself. If you encounter an error, you could choose to exit with a specific error code (You can have an error code to error text mapping somewhere).
Something like:
You can handle the return status best in your initial script itself.
Could anyone help me with the below scripting task.
my requirement is as below
1. I have two directories /var/tmp/dir1 & /var/tmp/dir2
once i run the script test.sh it should ask as below.
Please choose the below path 1 (or) 2
1. /var/tmp/dir1
2. /var/tmp/dir2
else. exit
2. once i... (4 Replies)
hey everyone, does anyone here have any good sites, or book recommendations that give you practice scripts to write? It's hard for me to think of scripts that I should write for practice. I've written a small backup script, but I'd rather have a source that gives me ideas, and practice for... (1 Reply)
This query is regarding the makefiles of linux kernel modules.
I saw at some sites on net it is suggesting to include the following path:
KERNEL_SOURCE := /usr/src/linux...
while at some places it is askibg to include /lib/modules path:
KERNEL_SOURCE := /lib/modules/2.6.27-7-generic/build... (0 Replies)
i hav a file like this
-rwxr-xr-x 1 root controlm 4141 Nov 13 2006 /opt/scripts/prod/fvaauditlos.ksh
-rwxr-xr-x 1 root controlm 3958 Nov 13 2006 /opt/scripts/prod/fvaexpchbk1.ksh
-rwxr-xr-x 1 root controlm 6471 Nov 13 2006 /opt/scripts/prod/fvaexpchbk2.ksh... (24 Replies)
Hello All,
I am working in a reputed software firm,currently working on testing platform (manual and automation).But I am very much intersted in unix and shell scripting,I feel that I am good at beginner level of shell scripting,still I want to practise shell scripting to become excel in it.I... (1 Reply)
Hi ,
I am trying to learn timers in linux kernel. I am trying to write a program where I can configure a timer to tick in every 5 seconds and a function should thus exicute in every five seconds. I tried one program with the help of linux/timer.h headerfile but I couldnt get the... (4 Replies)
I am NEW to Unix. I studied a few Unix Shell Commands 8 years ago in IBM AIX machines. I want to learn/brush up Unix shell commands, therefore I just installed Red Hat Linux 9 in a P3 machine. But I do not know where to start Unix Scripting in that Linux. I chose Desktop / Personnel while ... (2 Replies)
hi,
How to Install & configure the qmail in redhat linux? and also how to get the free qmail package?
I know the sendmail configuration in redhat linux. What is the features of qmail compared with sendmail?
Regards,
Jones (3 Replies)
As all of you know whenever a program "say a.c" is complied in linux using the gcc or the cc compiler..it shows the list of errors ( if the program contains any).. i want to modify the compier script so as to list the no of errors only and not the description about the error..like" parse error " ... (1 Reply)