Vmstat | nawk

I'm trying to parse vmstat output with this:

vmstat | nawk '/0/{printf "%s\ \n", $5}'

but output is different on two sparc Solaris 10 servers, one is missing line with 'free'.
why ?

Maybe different OS version or vmstat version.

wow, fast reply, thanks.
both are running Solaris 10, and vmstat alone output is identical, so it must be nawk or printf?

edit: ahh, my mistake, one server has 0 in line with free. sorry

is there a way to add newline only after last line? (so there is no newline after 'free')

Try:

vmstat | nawk '/0/{printf "%s\ ", $5}
END{print ""}'
1 Like