Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk and system command

Status
Not open for further replies.

superstarjpmc

Programmer
Jan 22, 2004
38
US
I have problems in executing the following script, this is part of a shell script (ksh). It runs fine in 'sh' but not under ksh.


The command 'finder' accepts the following as parameters

--> para1 -s "$4" -e "$2" -p "$3"


awk ' {
system("$MY_HOME/bin/finder para1 -s "$4" -e "$2" -p "$3" ")
}' < /etc/mnladm


File contents : /etc/mnladm contents are as below

FIRST-PARAM SECONDP THIRDPARA 1000
FIRST-PARAM SECONDP THIRDPARA 1001
FIRST-PARAM SECONDP THIRDPARA 1002

note:
There is no error while running this, but i expect output and not output is fetched.

Any help much appreciated
 
You may try this:
awk ' {
system("'$MY_HOME/bin/finder' para1 -s "$4" -e "$2" -p "$3" ")
}' < /etc/mnladm


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I tried to see whether a simple command works or not.. even the below command is not working. Any help on this pls.

I ran the below on an AIX host on a default shell, it works.
awk '{ system("date") }' < /etc/mnladm


Same command on a Solaris on ksh doesnt work..I changed the shell also but no success.
 
Have you tried nawk ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thanks PH, nawk works.

Whats the difference and why the difference ?

Thanks for your help.
 
Nawk is "new awk". If you have nawk, use it instead of awk because on some systems awk is very old and lacks many useful features. Under Solaris, use /usr/xpg4/bin/awk.

For an introduction to Awk, see faq271-5564.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top