Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

No output from awk command

$
0
0
Hi all,

In my SunOS 5.10, the command awk using BEGIN option doesn't print output variables like expected
here is my test:

with the following code everything is alright
ps -eo pcpu,args | grep "httpd" | awk ' { print $1 } '
the result is
0.1

However, with this command
ps -eo pcpu,args | grep "httpd" | awk 'BEGIN {cpu=$1} END { print cpu }'
the result is
BLANK SPACE

Viewing all articles
Browse latest Browse all 16232

Trending Articles