hi Chubler_XL, thanks again for your reply.
you have no idea, how much i appreciate it.
i apologize if i still have concerns, even after such a long conversation.
it's just that for this 2nd and 3rd file, it is possible that there is no 2nd file and only the third file... i forgot to mention that in the "usage" in my previous post.
it was very irresponsible of me. im sorry.
so these are the second and third file:
--second file--
--third file--
anyway, so i tried executing, the modified code, with both second and third file present, and as expected of your codes, it resulted perfectly.
although, i completely forgot to mention the possibility of the third file.
but then, i tried to execute it, with only the third file.
it seems that it treated it as the second file, since it was placed as $4... right?
could you suggest on what is the usage, if there is only a third file?
so far, it passes perfectly in these scenarios:
-second file only
-second and third file
is it possible to add/modify the code to be able to accept only the third file, but not treat it as second file?
Thanks again, in advance, you never fail to amaze me with your skills and thanks for sharing it with me, and to all those people you've helped here. thanks and i mean it.
PS i'm still trying to test for the merging that you said on your last note... i'll get back maybe post later, if i understood it correctly. thanks man.
Edit: No that dosn't work, without any changes to the code you can only A) use a dummy file with 1 record in it as the 2nd file or B) pass 3nd file in twice.
---------- Post updated at 02:24 PM ---------- Previous update was at 02:07 PM ----------
Here's a really kludgy solution (pass "none" in as your 2nd file):
Last edited by Chubler_XL; 08-31-2012 at 01:18 AM..
wow, that's a really clever thing you did there. really brilliant idea.
Though, does it really have to be "none" with quotation marks(" ")?
it seems that when i put only none, it doesn't work.
Though i think, it's pretty good now, but i still have to check for multiple files.
so, i need to merge the files manually first? and use the final merge file as first input file?
Thanks a lot man, though i would really like to know what exactly this code does? there seems to be unusual numbers (0 1 3 15) and directories there..?
is it going to create file or something?
Thanks again buddy, you are really a vital part of this site, thanks for all your help and patience this past few days. i really learned a lot from you, i hope i can become like you someday. thanks man
Thanks a lot man, though i would really like to know what exactly this code does? there seems to be unusual numbers (0 1 3 15) and directories there..?
is it going to create file or something?
Yes a dummy files is being created with just the header line of "dummy" the trap command is designed to ensure these dummy files are cleaned up, even when you ctrl-c or kill the script.
The numbers are the signal codes to trap, and thinking about the values used you are probably best with (1 2 3 15) instead of the list I originally had 1 is HUP (is terminal logs off, eg lost connection); 2 is Interupt (Ctrl-C), 3 is QUIT (normal termination) and 15 is TERM (killed).
Not sure why you need quotes around none, it works fine without them on my system.
This User Gave Thanks to Chubler_XL For This Post:
Yes a dummy files is being created with just the header line of "dummy" the trap command is designed to ensure these dummy files are cleaned up, even when you ctrl-c or kill the script.
The numbers are the signal codes to trap, and thinking about the values used you are probably best with (1 2 3 15) instead of the list I originally had 1 is HUP (is terminal logs off, eg lost connection); 2 is Interupt (Ctrl-C), 3 is QUIT (normal termination) and 15 is TERM (killed).
Not sure why you need quotes around none, it works fine without them on my system.
You may want to trap on conditions 0 1 2 3 and 15. 3 does mean that the process was terminated by a SIGQUIT signal, but that is not normal termination. 0 is normal termination (i.e., terminated by the process exiting).
Given the complexity of the command line processing here, I would suggest using getopts, with a -x excl_file option to specify the exclude file, -a add_file option for the newest operand that was added, and putting the file operands at the end of the command line as separate operands instead of as a quoted, space separated list in the 1st operand (thus making it much simpler to specify a group of file operands as something likefile*.csv).
This User Gave Thanks to Don Cragun For This Post:
Hi All,
In the below script, I am calling one sql file test.sql If this file returns any data then I have to generate this file test_$RUN_DATE.FCNA If the sql files returns no data then I dont want to generate this file test_$RUN_DATE.FCNA.
I tried one approach like: check the size of FCNA files... (1 Reply)
Hi,
I have below script, i want to monitor that that ntp server listed in setting is under sync or not. I wrote below script but it is not working properly.
Here are problems, first it should server under sync if "*" shows and rest if shows "+" it means it is next server in waiting list.... (4 Replies)
Hi
I have some list of files in a .dat
i need to read them line by line and assing them to variables.
For ex: list of files are some,some1
i need two variables g1 as some and g2 as some1.
and then need to perform some operations on g1 and g2
for which i can get some o/p, i need to capture... (2 Replies)
I want the below script to omit every chunk of data that contains a specific hostname.
here's the scenario. i have a configuration file that contains the configuration of several hosts. a sample of this configuration file is this:
define host {
address ... (12 Replies)
Hello Team,
I have prepared script which will check for listening message for ports 1199,1200 and 1201. I need modifcation in script in such a way that if port 1200 is not listening then it should message rmi port 1200 is not listening. Smap for port 1199 and 1201.
kindly guide me to acheive... (4 Replies)
Hi all
Iam very new to Shell Scripting, I have to modify a shell script looking at an existing one except that it will query against some table X in A database.
Befor Spooling check if there are any reload files if there archive the files.
The above scipt executes some abc.sql which will b a new... (2 Replies)
Hi All
I have files contains rows which look like this:
2 20090721_16:58:47.173 JSUD2 JD1M1 20 IAM 966591835270 249918113182 b 3610 ACM b 3614 ACM b 3713 CPG b 3717 CPG f 5799 REL b 5815 RLC b 5817 RLC :COMMA: NCI=00,FCI=6101,CPC=0A,TMR=00,OFI=00,USI: :COMMB: BCI=1234: :RELCAUSE:10:
... (1 Reply)
i have the following perl script.but it searches for a given filename.
i want to run the same script in my directoy which has subdirectories too and it has to display the file if sreach satisfies along with directory name.
can anyone help me:
perl script:
my $FILE = $ARGV;
for zf in... (4 Replies)