Pegging counter | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Pegging counter

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-27-2013
vanand420 vanand420 is offline
Registered User
 
Join Date: Jul 2005
Last Activity: 27 June 2013, 9:52 AM EDT
Posts: 98
Thanks: 13
Thanked 1 Time in 1 Post
Pegging counter

Hi Experts,

I am in need for some help. My competence level on unix is not at all helping me to resolve this. Please help.

My Input for a system command is as under:

Counters are getting pegged each hour. I need to have a difference printed rather than pegged counter values.


Code:
Counter Name     06/27 17:00     06/27 16:00     06/27 15:00
============================================================
Apple:              21056370        20966781        20880827
Mango:              13698085        13639570        13583601
Cherry:                34591           34468           34365
Banana:                46900           46707           46555

I am looking to get the difference of all the counter name for the hours.

Expected output:


Code:
Counter Name                 06/27 17:00     06/27 16:00         
=========================================
Apple                     :       89589	85954             
Mango                    :       58515	55969              
Cherry                    :       123	103        
Banana                   :       193	152

i.e line has arrived as

Code:
Apple                     :       89589(21056370-20966781)	85954(20966781-20880827)

Thanks in advance..

Last edited by zaxxon; 06-27-2013 at 08:30 AM..
Sponsored Links
    #2  
Old 06-27-2013
Peasant's Avatar
Peasant Peasant is offline
Registered User
 
Join Date: Mar 2011
Last Activity: 17 September 2014, 6:51 AM EDT
Posts: 651
Thanks: 17
Thanked 146 Times in 142 Posts
See if this helps :

Code:
awk 'NR <= 2 { print } NR > 2 { print $1" : "$3-$4 FS $4-$5 }' input

The Following User Says Thank You to Peasant For This Useful Post:
vanand420 (06-27-2013)
Sponsored Links
    #3  
Old 06-27-2013
vanand420 vanand420 is offline
Registered User
 
Join Date: Jul 2005
Last Activity: 27 June 2013, 9:52 AM EDT
Posts: 98
Thanks: 13
Thanked 1 Time in 1 Post
thanks a lot friend..!! it worked for me..
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
Counter Froob Shell Programming and Scripting 1 12-19-2012 11:58 PM
histogram or counter chen.xiao.po UNIX for Dummies Questions & Answers 2 06-30-2011 01:41 AM
DelimiterCount: how to use a counter suresh01_apk Shell Programming and Scripting 4 12-17-2010 03:56 AM
counter pega Shell Programming and Scripting 1 10-28-2009 07:14 PM
counter problem jwholey Shell Programming and Scripting 2 03-19-2008 04:39 PM



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