Thanks CarloM, this is what I did with your gawk proposal to analyse ${0} and populate the variables V_SEVERITY and V_INFO:
and these were my results:
Quote:
======= Case 1: OK =======
Argument String = "UNIV ABORTED JOB GS1 VMSDLCEREF 2011/10/25 11:42 0000201 0000000 UNIV56 X vmsdlceref "
Expects:
V_SEVERITY=""
V_INFO=""
Gets:
V_SEVERITY=""
V_INFO=""
NOTE: There should be 56 spaces after vmsdlceref in the argument string, but the forum software strips them.
Quote:
======= Case 2: NOK =======
Argument String = "UNIV ABORTED JOB GS2 VMSDLCEREF 2011/10/25 11:46 0000202 0000000 UNIV56 X vmsdlceref 3333 "
Expects:
V_SEVERITY="3333"
V_INFO=""
Gets:
V_SEVERITY=""
V_INFO=""
Note: there should be 51 spaces after 3333 in the argument string.
Quote:
======= Case 3: NOK =======
Argument String = "UNIV ABORTED JOB GS3 VMSDLCEREF 2011/10/25 11:49 0000203 0000000 UNIV56 X vmsdlceref 12345678901234567890123456789012345678901234567890"
Expects:
V_SEVERITY=""
V_INFO="12345678901234567890123456789012345678901234567890"
Gets:
V_SEVERITY=""
V_INFO=""
Quote:
======= Case 4: OK =======
Argument String = "UNIV ABORTED JOB GS4 VMSDLCEREF 2011/10/25 11:38 0000200 0000000 UNIV56 X vmsdlceref 9999 one two three four five six seven eight nine ten X"
Expects:
V_SEVERITY="9999"
V_INFO="one two three four five six seven eight nine ten X"
I probably misadapted the command. Any suggestions?
Zagga
Last edited by zagga; 10-25-2011 at 07:07 AM..
Reason: spaces were trimmed in the argument string
Hi,
I am new to unix. Is their a way to pass the output of the line below to a variable var1.
ls -1t | head -1.
I am trying something like var1=ls -1t | head -1, but I get error.
Situation is: I get file everyday through FTP in my unix box. I have to write a script that picks up first... (1 Reply)
I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help.
echo $SH_VAR | command_line Syntax.
The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
public class HelloWorld {
public static void main(String args) {
System.out.println("Welcome, master");
}
}
and I compiled using
javac HelloWorld.java
]
Suppose that I execute the following command directly from the shell:
java -XX:OnError="gdb - %p" HelloWorld
Then it works... (8 Replies)
I have a script file. test.sh
I am running it by command
sh test.sh 10102004
where 10102004 is the script argument.
I wan to assign this 10102004 to a variable.
How can i do this?
I tried &1 and awks ARGV its not working :( (2 Replies)
hi all
let say I run the ./xxx.bash x x x x or ./xxx.bash x x x or ./xxx.bash x x x x x
the last argument always a filename
the last arugment filename format is 5-10-22.txt
my question is how can I put this arugment into variable and I can use it in sed or any other way that i can use
I... (1 Reply)
Hi,
I had written a shell script to pass command line argument to variable in a function.
Here is my code:
main
if ; then
.$1
echo $1
get_input_file
else
echo "input file $1 is not available"
fi
get_input_file()
{
FILE = "$1"
echo $FILE
} (10 Replies)
I am trying to get the details of iowait for last hour using sar. When I give date as argument it works.
# sar -u -s 22:24:00 -e 23:24:00
Linux 2.6.35.13-26 (XX.server.com) 04/11/2012
10:30:03 PM CPU %user %nice %system %iowait %idle
10:40:04 PM all 5.03 ... (2 Replies)
I have a script.
#!/bin/sh
cur_$1_modify_time=Hello
echo "cur_$1_modify_time"
When I run like
sh /root/script1 jj
I expect value "Hello" being assigned to variable "cur_jj_modify_time" and output being "Hello" ie echoing $cur_jj_modify_time
But the output comes as
# sh... (3 Replies)
Hi,
I am trying to pass a variable as an argument to another script. While substitution of variable, I am facing a problem.
varaiable "a" value should be -b "FPT MAIN".
When we pass "a" to another script, we are expecing it to get substitue as ./test.sh -b "FPT MAIN". But, it is getting... (9 Replies)
Hi guys,
I have created a csh script which allows user to pass input argument with the script like:
cluster_on_lev3.csh -t <value> -p <value>
Example:
cluster_on_lev3.csh -t 2.3 -p 0.05
Now I want to create an error code where if user passes input argument without spaces , the code... (16 Replies)