Vmstat | nawk | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Vmstat | nawk

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-20-2013
orange47 orange47 is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 14 December 2014, 4:53 AM EST
Location: Yugoslavia
Posts: 268
Thanks: 68
Thanked 10 Times in 10 Posts
Vmstat | nawk

I'm trying to parse vmstat output with this:


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

but output is different on two sparc Solaris 10 servers, one is missing line with 'free'.
why ?
Sponsored Links
    #2  
Old 06-20-2013
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 19 December 2014, 2:53 AM EST
Location: St. Gallen, Switzerland
Posts: 6,251
Thanks: 126
Thanked 455 Times in 414 Posts
Maybe different OS version or vmstat version.
Sponsored Links
    #3  
Old 06-20-2013
orange47 orange47 is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 14 December 2014, 4:53 AM EST
Location: Yugoslavia
Posts: 268
Thanks: 68
Thanked 10 Times in 10 Posts
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')

Last edited by orange47; 06-20-2013 at 03:43 AM..
    #4  
Old 06-20-2013
Don Cragun's Avatar
Don Cragun Don Cragun is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 20 December 2014, 9:23 PM EST
Location: San Jose, CA, USA
Posts: 5,261
Thanks: 205
Thanked 1,756 Times in 1,496 Posts
Try:

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

The Following User Says Thank You to Don Cragun For This Useful Post:
orange47 (06-20-2013)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Nesting - two nawk into one nawk gc_sw Shell Programming and Scripting 2 10-21-2010 09:03 AM
vmstat kapilk Shell Programming and Scripting 3 07-28-2009 08:53 AM
vmstat help jcpetela Linux 1 01-21-2009 05:18 PM
how to access values of awk/nawk variables outside the awk/nawk block? saniya Shell Programming and Scripting 5 05-13-2008 08:37 AM
vmstat big123456 UNIX for Advanced & Expert Users 4 12-21-2005 06:56 AM



All times are GMT -4. The time now is 10:33 PM.