![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| getting the column header in the output ! | ali560045 | Shell Programming and Scripting | 4 | 12-04-2008 04:55 AM |
| 4 column tsv file, output 1 specific column | casphar | Shell Programming and Scripting | 6 | 11-12-2008 04:04 PM |
| how to cut off last column from the output | manmeet | Shell Programming and Scripting | 9 | 11-05-2008 07:32 AM |
| Loop column output | handband2 | UNIX Desktop for Dummies Questions & Answers | 1 | 11-03-2008 10:46 PM |
| Sub. numbers in column of output with If | ja156194 | Shell Programming and Scripting | 11 | 02-12-2007 01:52 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
top output for six processes with the same name, output changed from column to row
Hi,
I have a system under test, and I use a script that does a ps. The output, is in the following format, it's basically the timestamp, followed by the rss and vsize. PHP Code:
I really want to track the cpu usage of these 6 processes with the same name, and spit them to a file, every 30s, in the same format as above, i.e. timestamp process1CPU process2CPU process3CPU process4CPU process5CPU process6CP I've tried the following, but it just hangs at the part where it tries to output the results from top, maybe its because it comes out in a column? I need it in row format, so I can easily import to Excel and analyse. Here's the script PHP Code:
This is what I'm trying to get as output PHP Code:
|
|
||||
|
try this
#!/bin/bash outputFile=topOutput_`uname -n` echo "Output: " $outputFile for ((;;)); do (date +%T | tr "\n" " " && ps -A ux | sort -rn -k 3 | awk 'NR<6 && $3!="%CPU"{printf "%s ",$3} END {printf "\n"}') >> $outputFile sleep 30 done |
|
||||
|
This is almost exactly what I'm looking for, but when I run it I get this instead...
PHP Code:
PHP Code:
PHP Code:
Last edited by Bloke; 05-28-2009 at 12:19 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|