Unix/Linux Go Back    


Gentoo Gentoo Linux is a versatile and fast, completely free Linux distribution geared towards developers and network professionals.

top in batch mode, cpu info is wrong

Gentoo


Closed    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 08-20-2008
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline Forum Staff  
Moderator
 
Join Date: Feb 2007
Last Activity: 18 January 2017, 8:05 AM EST
Location: The Netherlands
Posts: 7,746
Thanks: 139
Thanked 558 Times in 520 Posts
Your output has 2 sections beginning with the word top and we want to print the second one.
After we met the second top i has the value 2.
i==2 is a condition here for awk, if it's true awk print the record per default so awk begins to print after we've reach the second top.
i==2 is similar to {if i == 2 {print $0}}

Have a read of an awk tutorial, you can find some links here:

http://www.unix.com/answers-frequent...tutorials.html

Hope this helps.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
FTP in batch mode cvsanthosh Shell Programming and Scripting 6 04-18-2012 03:50 AM
how to run glance over ssh in batch mode delphys HP-UX 5 10-20-2011 04:47 PM
How to run VI in batch mode grossgermany Shell Programming and Scripting 5 04-04-2010 10:12 AM
Sftp in Batch Mode sivaemn UNIX for Advanced & Expert Users 2 07-01-2007 07:52 AM



All times are GMT -4. The time now is 09:01 PM.