How to pass a parameter in system function
e.g system(script parameter)
i want to run a shell script along with a parameter
A sample,
#!/bin/ksh
echo "Using $@ arguments to execute the awk"
echo 1 2 3 | awk -v cmd=$1 -v From=$2 -v To=$3 '{ system(cmd" "From" "To ) }
Thanks
Nagarajan G
thanx nagarjuna for ur reply
but i have sm different problem
my test.awk is like this
BEGIN {
jobid = "/tmp/test.txt"
system( "echo `echo $jobid`")
system("sh /tmp/test jobid ")
}
in the 3rd line it is not displaying the value of the jobid so when ever i am runing the shell script and passing the file path its not getting that. i am new to awk programmimg could u plz send me a sample script to do that.
Wirh Regards
alok
Please try this,
echo 1 | awk 'BEGIN {jobid="/tmp/test.txt"} { system ( "echo "jobid ) ; system ("cat " jobid)}'
Thanks
Nagarajan G
awk -v fname="/tmp/filename" -v cmd=$cmdname" '{system(cmd" "fname)}'
Is this same as that of your earlier post?
http://www.unix.com/shell-programming-scripting/51386-awk-parameter.html
Thanks
Nagarajan G