The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
using awk != parameter karthikn7974 Shell Programming and Scripting 4 04-28-2008 06:59 AM
how do I make dynamic parameter names? Or get the value of a parameter evaluated twi Awanka Shell Programming and Scripting 2 04-19-2007 09:37 PM
parameter u263066 Shell Programming and Scripting 5 10-12-2006 03:46 AM
$- parameter ... moxxx68 UNIX for Dummies Questions & Answers 2 02-10-2005 07:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-29-2008
alokmits alokmits is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 4
Angry awk parameter

How to pass a parameter in system function
e.g system(script parameter)
i want to run a shell script along with a parameter
  #2 (permalink)  
Old 01-29-2008
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
A sample,
Code:
#!/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
  #3 (permalink)  
Old 01-29-2008
alokmits alokmits is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 4
Angry

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
  #4 (permalink)  
Old 01-29-2008
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Please try this,
Code:
echo 1 | awk 'BEGIN {jobid="/tmp/test.txt"} { system ( "echo "jobid ) ; system ("cat " jobid)}'
Thanks
Nagarajan G
  #5 (permalink)  
Old 01-29-2008
ramen_noodle ramen_noodle is offline Forum Advisor  
Registered User
  
 

Join Date: Dec 2007
Location: Virginia, USA.
Posts: 251
Code:
awk  -v fname="/tmp/filename"  -v cmd=$cmdname" '{system(cmd" "fname)}'
  #6 (permalink)  
Old 01-30-2008
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Is this same as that of your earlier post?
awk parameter

Thanks
Nagarajan G
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0