- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- Operating System - Tru64 Unix
- >
- Re: Collect output
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2004 06:21 PM
тАО05-04-2004 06:21 PM
Does any have written script to extract info from collect output?. For example I have output as in attached text file. How could I use awk/sed/perl to extract the data column wise?
Thanks
Siva
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2004 06:35 PM
тАО05-04-2004 06:35 PM
Re: Collect output
awk -F "\t" '{print $NR, ($1)" "($2)}' filename >newfile.txt
this assumes using "\t" that the file is delimited using tab, $NR number of 'records' and the other $ pertain to column ids,etc.
if you have access to gawk, this lets you use functions such as toupper and tolower, which you may also find helpful.
hope this helps.
regards
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2004 06:45 PM
тАО05-04-2004 06:45 PM
Re: Collect output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2004 06:59 PM
тАО05-04-2004 06:59 PM
Solutionawk -F " " '{print $1 $2}' 99749.txt
this will print the first and second columns of the file using space as a delimiter, you might find it easier to use the -h (header) switch for collect to exclude the header information, which might also make the information easier to organize.
hope this helps
regards
Matt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2004 07:10 PM
тАО05-04-2004 07:10 PM
Re: Collect output
Regards
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-05-2004 02:40 PM
тАО05-05-2004 02:40 PM
Re: Collect output
It woudl really help if you also included a template of what you want in yuo output. We are not mindreaders!
When parsing collect output you need to learn to recognize 'sections', or be able to distiguish the sometime minor difference in the dataline. Like a line with 13 words all numbers is possible the CPU SUMMARY.
For each line you gather 'interesting' data points and print them all out when done.
For example:
perl collect-summary your-file
will print: io=586, mb=52.38, cpu=6, free=23
-------- collect-summary ----
while (<>) {
$section=$1 if (/^# (DISK|LSM|CPU|MEMORY|SINGLE)/);
@words = split;
print "$section $words[0] $words[1]\n";
if (($section eq "DISK") && (/dsk/)) {
$io += $words[4] + $words[6];
$mb += $words[5] + $words[7];
}
if ($section eq "CPU") {
$cpu = $1 + $2 if (/^\s+(\d+)\s+(\d+)/);
}
if ($section eq "MEMORY") {
next if ($memory_header++ < 3); #skip header lines
$free = $words[0];
}
}
print "io=$io, mb=$mb, cpu=$cpu, free=$free\n"
Enjoy!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-05-2004 08:58 PM
тАО05-05-2004 08:58 PM
Re: Collect output
To make grepping easier, you could add the "-t" flag in your collect command.
This will add a tag before each line.
Here is an example for the CPU figures
# CPU SUMMARY
# USER SYS IDLE WAIT INTR SYSC CS RUNQ AVG5 AVG30 AVG60 FORK VFORK
cpusum: 0 2 98 0 252 1820 1693 0 0.07 0.03 0.01 0.00 0.00
# SINGLE CPU STATISTICS
# CPU USER SYS IDLE WAIT
cpusin: 8 0 3 97 0
cpusin: 9 0 1 99 0
cpusin: 10 0 2 98 0
cpusin: 11 1 1 98 0
Hope it might be useful
Joris