Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 17th January 2007, 06:56 PM
keysorsoze Offline
Registered User
 
Join Date: Jan 2005
Posts: 9
Awk for specific lines in text

Hi! I am looking for help in Awking for text, I have obtained what I needed with your awk '{print $8}' command. However, I get a ton of values. How do I narrow them down to just a specific value such as the %idle cpu rate. I tried awk '{print $8}' | grep %idle but all I get is %idle %idle %idle. The goal is to just obtain the field:
%idle statistics.
96.66
92.11
97.94
97.70
98.90



This is a snapshot of a server for every 5 minutes so the file is huge

Here are the awk results:

awk '{print $8}'

%idle
96.66
92.11
97.94
97.70
98.90


TX-ERR
0
BMRU
BMRU
BMRU
BMRU
BMRU
BMRU
0

wkB/s
65.91

wkB/s
289.93

wkB/s
270.20
Reply With Quote
  #2  
Old 17th January 2007, 08:14 PM
brunson Offline
Registered User
 
Join Date: Jun 2005
Location: Westminster, Colorado
Posts: 2,304
You'd use something akin to this...
Code:
awk '{ if ( $8 == "" ) { inidle=0 }
if ( inidle == 1 ) { print $8 }
if ( $8 == "%idle" ) { inidle=1 } }'
Awk is a bastard language, you should use something else, like Python.
__________________
Registered Linux User #4837
411th in line to get sued by Micro$oft
Quote:
Basically, to learn Unix you learn to understand and apply a small set of key ideas and achieve expertise by expanding both the set of ideas and your ability to apply them - Paul Murphy
Reply With Quote
Reply

Tags
awk, lines, specific, text

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Question] How to remove all lines that contain certain text in VI beyonddc Using Fedora 2 22nd August 2007 04:58 PM


Current GMT-time: 00:29 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat