![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 11:10 AM |
| SSH Problem auth problem | budrito | UNIX for Advanced & Expert Users | 1 | 03-17-2004 10:12 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Awk problem
Hi. I'm really not good in awk syntax or scripting by awk and therefore requesting some assistance. Code:
cat $TEMPFILE | grep -v ^$ | awk '{print $2, $3, $4, $8}' | while read appname apphandle eitthvad pid
do
cat $OUTFILE | awk -F ";" '$1 == '$pid' {print $1, $2, $3, $4, $5, $6, $7, $8, '$apphandle $appname'};'
done
Awk complains about the "'$apphandle $appname'" part. I can include one variable in the output statement by using ' around the variable name, but when there are two or more things break down. Any thougts? |
|
||||
|
Here is one way to do it. I would avoid passing in variables in the manner that you are attempting. It's too messy. Code:
while read appname apphandle eitthvad pid
do
[[ ${appname}${apphandle}${eitthvad}${pid} = "" ]] && continue
nawk -F\; -v pid=${pid} -v apphandle=${apphandle} -v appname=${appname} '
$1 == pid {
print $1, $2, $3, $4, $5, $6, $7, $8, apphandle appname
}' $OUTFILE
done < $TEMPFILE
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|