The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to print data between 2 lines in a file kamesh83 UNIX for Advanced & Expert Users 5 12-18-2008 12:14 PM
Pulling multiple lines of text DumDum Shell Programming and Scripting 2 03-10-2008 12:15 PM
pulling a column from a file in ksh dangral Shell Programming and Scripting 8 01-13-2003 04:10 PM
pulling the following line from a file peter.herlihy UNIX for Dummies Questions & Answers 4 08-29-2002 10:09 PM
Pulling out fields from a file Saz UNIX for Advanced & Expert Users 2 09-30-2001 04:31 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-24-2006
MizzGail's Avatar
MizzGail MizzGail is offline
Registered User
  
 

Join Date: Sep 2001
Location: Syracuse, NY
Posts: 164
Pulling data and following lines from file

I saw a few posts close to what i want to do, but they didn't look like they would work exactly.. or I need to think out of the box on this.

I have a file that I keep server stats in for my own performance analysis. this file has the output from many commands in it (uptime, vmstats, ps, swap space) . I have since rewritten my monitoring, but now I need to go back and pull only the vmstats and its response out of my files for 2004.

I wrote a script that can walk through the file one line at a time and look for the value vmstat and pull out the date in the following line (see below file excerpt) but I can' t figure out how to tell the script to pull the lines with the actual data. I really only want the cpu idle column with a date in my output:
Example, I want my output to be:

2004.07.01[00:04:03] 42
2004.07.01[00:04:03] 48

etc.


my input file excerpt:


Unix Uptime
2004.07.01[00:04:03]

00:04 up 4 days, 11:49, 34 users, load average: 22.66, 25.20, 25.54

vmstat 2 5
2004.07.01[00:04:03]

Virtual Memory Statistics: (pagesize = 8192)
procs memory pages intr cpu
r w u act free wire fault cow zero react pin pout in sy cs us sy id
33 849 38 278K 34K 200K 96M 16M 47M 3M 17M 457K 665 9K 8K 42 18 40
29 854 38 280K 33K 200K 6112 657 3917 0 617 0 595122K 10K 48 52 0
36 847 37 279K 34K 200K 4380 145 3598 0 112 0 687 77K 10K 55 45 0
28 857 39 279K 34K 200K 2310 447 1325 0 396 0 608 65K 10K 58 42 0
33 852 38 279K 33K 200K 3569 268 2399 0 284 0 611129K 10K 53 47 0

swap space
2004.07.01[00:04:16][/FONT]
 

Bookmarks

Tags
load average, performance

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0