calling script from awk


 
Thread Tools Search this Thread
Operating Systems Solaris calling script from awk
# 1  
Old 07-13-2008
calling script from awk

Hi,

I'm not sure, there is solution exist for this problem. I'm facing problem in calling a unix script from awk code. Here is code

nawk -F'=' '
BEGIN { }
function runtest(string)
{
LINE
}
/^[.*\]/ { # getting module name
t=$1
module=substr(t,2,(length(t)-2))
runtest(module)
}
/INCLUDE/ {
}
/LEVEL/ {
}
/LOG_LEVEL/ {
}

END {}
' test-suite.cfg

<<<<<<<<<<<<<<>>>>>>>>>>
Content in the test-suite.cfg
[module1]
INCLUDE=Y
LEVELS=BASIC,INTER,ADVANCE
LOG_LEVEL=10
REPROT=module1.log

...
..

<<<<<<<<<<<<<<<<>>>>>>>>>>

In the "LINE", i'm trying to call unix script to start test-suite based on the input arguments such as "module, level, leg_level...".

I tried LINE with following but nothing worked
ATT 1. ./test-suite/module/basic/start.ksh
Error:
context is
>>> ./test-suite/module/basic/start <<< .ksh
nawk: illegal statment at source line 10 in function

Tried with escape for "." also didnt work
ATT 2. test-suite/module/basic/start
Error : nawk division by zero


Basicaly, i want to secute the script based on the input argument and get the test results also.

Kindly help me to resolve this problem.

Thanks and Regards,
Balaji
# 2  
Old 07-13-2008
did you try with the following, ensuring that the config and script is within the same dir?
./<script> <cfg>
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling shell script within awk script throws error

I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks sh: -c: line 0: syntax error near unexpected token `newline' sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies

2. UNIX for Dummies Questions & Answers

Calling all the awk gurus out there.

Hi all, I just signed up to the forums, although, I have lurked on here for awhile. Anyways, my issue is I am trying to get awk to spit out something I can use without having to spend hours in excel hell haha. So, I used sed to replace the spaces with semicolons and redirected that to a file. ... (6 Replies)
Discussion started by: savigabi
6 Replies

3. Shell Programming and Scripting

Calling array inside awk

Hello I have the file df.tmp FS is actually the / FS but escape character\ and end of line $ is used in order to fetch exctly / and not other filesystems. awk '/\/$/ {print $(NF-1)+0}' df.tmp will work properly and return a value eg. 60 but when I am trying to issue the command with the array... (3 Replies)
Discussion started by: drbiloukos
3 Replies

4. Shell Programming and Scripting

calling awk from php not working

I want to run awk from php to do some text processing. I am giving an extremely simple example below: onecol.awk file ------------------- { print "Hello!"; } f1.txt --------- aaa ccc eee f2.txt --------- (6 Replies)
Discussion started by: mary271
6 Replies

5. Shell Programming and Scripting

Calling awk fom csh

I have to call two awk scripts where the second one used the output from the first one. Am wondering if it may happen that the second awk might start before the first awk finished creating the file... if ($nAnomaly == 1) then awk -v anomaly=$Anom -v zloc="$zmin/$zmax" -v dz=$dz \ ... (1 Reply)
Discussion started by: kristinu
1 Replies

6. Shell Programming and Scripting

Calling awk from csh

I am trying to call awk from a csh script using awk '{print $1, -$2, $3}' $fvmod.vel > $fvmod.xzv and getting awk: Command not found. Running awk '{print $1, -$2, $3}' $fvmod.vel > $fvmod.xzv on the command line with the actual filenames works (2 Replies)
Discussion started by: kristinu
2 Replies

7. Shell Programming and Scripting

Calling function in awk statement.

Hi All, I have an awk statement and a function defined in a script. I am trying to call the function from inside awk statement, i.e. awk ' myFunk () ;' filename But when I define myFunk() before awk, then I receive this error: s2.sh: line 48: syntax error: unexpected end of file and... (5 Replies)
Discussion started by: morningSunshine
5 Replies

8. Shell Programming and Scripting

Calling of search using awk

Database rina lives:fatin:20:20:20 rina:fatin:20:20:20 i am having a small problem in extracting out the information from the database. For example, if i were to input a book titled rina into my search , i would only want it to display the row which has the title rina, like this ... (4 Replies)
Discussion started by: gregarion
4 Replies

9. Shell Programming and Scripting

calling function inside awk

Hi All, My 1.txt contains some functions fun1() .... .... fun2() .... .... I can call these fun from 2.txt inside awk as below value="`fun1 "argument1"`" awk 'BEGIN {printf ("%s", "'"$value"'")}' I need to modify the above code so that without using the variable to store... (2 Replies)
Discussion started by: jisha
2 Replies

10. Shell Programming and Scripting

Calling ipcrm from awk

Hello, With next simple command line I get all allocated semaphore numbers: ipcs -s | awk 'NR > 3 {print $2}' Now I want to add ipcrm -s before each semaphore id and actually delete every last of them. The question is: Can I do the operation in a command itself, without redirecting awk... (2 Replies)
Discussion started by: BaruchLi
2 Replies
Login or Register to Ask a Question