|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
awk value return
I have a script in awk and i have a unix shell script too ,and i want to call from the unix shell the awk script but that is returning a value according to what have been checked and found like boolean value in the awk script.
How do i do it? |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
It's not clear what you're trying to achieve, can you clarify your question with an example?
Regards |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
the usual way to execute an awk script is
awk -f awkscript filename cheers, Devaraj Takhellambam |
|
#4
|
|||
|
|||
|
an example
#!/bin/sh
awk -f input_check.awk strings.txt \\here i want the input_check.awk script to return a value that is boolean to the value will be used after this line with a if condition awk -f messview.awk messages awk -f report_maker.awk warn.txt i=1; new="yes" for file in `ls` do file_check="part"$i; if [ "$file" = "$file_check" ] then if [ "$new" = "yes" ] then cat $file_check > "reporta.txt" new="no" else cat $file_check >> "reporta.txt" fi rm $file_check (( i = i+1 )) fi done |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Quote:
Make sure you return either a 0 or 1 in your awkscript. Then you can test in your unix script for 0 or 1. cheers, Devaraj Takhellambam |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
But how can i return the value like this with awk?
|
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
or Code:
print "1" |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FTP Return 32 | wilsonSurya | IP Networking | 3 | 10-10-2008 03:39 AM |
| to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's | manas6 | UNIX for Dummies Questions & Answers | 0 | 06-05-2008 06:44 AM |
| Return Key | chapmana | Shell Programming and Scripting | 2 | 11-29-2006 03:52 AM |
| FTP return value | Shaz | UNIX for Advanced & Expert Users | 7 | 06-11-2003 04:09 PM |
| the return value $? | gusla | Shell Programming and Scripting | 3 | 12-08-2002 07:30 PM |
|
|