- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: need script to add kr/s and kw/s columns for a...
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
тАО07-09-2008 08:12 AM
тАО07-09-2008 08:12 AM
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 3.0 0.0 24.1 0.0 0.0 0.0 0.8 0 0 c6t0d51
0.0 1.0 0.0 8.0 0.0 0.0 0.0 0.5 0 0 c6t0d50
0.0 3.0 0.0 48.2 0.0 0.0 0.0 0.7 0 0 c6t0d40
0.0 1.0 0.0 8.0 0.0 0.0 0.0 0.4 0 0 c7t0d92
Wed Jul 9 00:29:56 2008
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 2.0 0.0 32.0 0.0 0.0 0.0 0.9 0 0 c6t0d50
0.0 1.0 0.0 8.0 0.0 0.0 0.0 2.6 0 0 c7t0d92
0.0 1.0 0.0 16.0 0.0 0.0 0.0 0.5 0 0 c7t0d50
Wed Jul 9 00:29:58 2008
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
Wed Jul 9 00:29:59 2008
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 3.0 0.0 24.1 0.0 0.0 0.0 1.0 0 0 c6t0d51
0.0 3.0 0.0 48.2 0.0 0.0 0.0 1.2 0 0 c6t0d40
Wed Jul 9 00:30:00 2008
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 1.0 0.0 8.0 0.0 0.0 0.0 0.4 0 0 c6t0d51
0.0 2.0 0.0 32.2 0.0 0.0 0.0 0.7 0 0 c6t0d50
0.0 1.0 0.0 16.1 0.0 0.0 0.0 0.5 0 0 c7t0d50
Wed Jul 9 00:30:01 2008
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
3.0 0.0 21.0 0.0 0.0 0.0 0.0 15.9 0 5 c6t0d92
22.0 145.1 176.1 1280.4 0.0 0.1 0.0 0.9 0 9 c6t0d89
0.0 3.0 0.0 24.0 0.0 0.0 0.0 0.7 0 0 c6t0d51
4.0 0.0 32.0 0.0 0.0 0.1 0.0 13.8 0 3 c7t0d92
2.0 14.0 16.0 128.0 0.0 0.0 0.0 0.6 0 1 c7t0d50
2.0 2.0 32.0 9.0 0.0 0.1 0.0 35.3 0 6 c3t0d0
Wed Jul 9 00:30:02 2008
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 2.0 0.0 32.2 0.0 0.0 0.0 0.6 0 0 c6t0d89
0.0 1.0 0.0 0.5 0.0 0.0 0.0 0.3 0 0 c6t0d52
0.0 7.0 0.0 112.7 0.0 0.0 0.0 1.2 0 0 c6t0d40
0.0 4.0 0.0 64.4 0.0 0.0 0.0 0.8 0 0 c7t0d89
0.0 2.0 0.0 32.2 0.0 0.0 0.0 0.9 0 0 c7t0d40
Eg for the first section:
Total Wed Jul 9 00:29:55 2008: kr/s 0.0 kw/s: 88.3
Anyone has attempted it?
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2008 09:07 AM
тАО07-09-2008 09:07 AM
Re: need script to add kr/s and kw/s columns for a specific time window
# perl -nale 'if (/00:29:55/../00:29:56/) {$hdr||=$_;next unless /^\d/;$s2+=$F[2];$s3+=$F[3]};END{print "Total ",$hdr," kr/s ",$s2," kw/s ",$s3}'
...yields:
Total Wed Jul 9 00:29:55 2008 kr/s 0 kw/s 88.3
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2008 12:09 PM
тАО07-09-2008 12:09 PM
Re: need script to add kr/s and kw/s columns for a specific time window
Now, question is how to generate
perl -nale 'if (/00:29:56/../00:29:58/) {$hdr||=$_;next unless /^\d/;$s2+=$F[2];$s3+=$F[3]};END{print "Total ",$hdr," kr/s ",$s2," kw/s ",$s3}'
...
perl -nale 'if (/00:30:01/../00:30:02/) {$hdr||=$_;next unless /^\d/;$s2+=$F[2];$s3+=$F[3]};END{print "Total ",$hdr," kr/s ",$s2," kw/s ",$s3}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2008 12:47 PM
тАО07-09-2008 12:47 PM
Re: need script to add kr/s and kw/s columns for a specific time window
With regard to your second question, specifying the range:
(/00:29:55/../00:30:02/)
...will correctly sum the appropriate columns although the description of the period will only represent the beginning argument.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2008 01:02 PM
тАО07-09-2008 01:02 PM
Re: need script to add kr/s and kw/s columns for a specific time window
OK, this is better. It will sum any range you specify and report the range used in the result:
# perl -nale 'if (/00:29:55/../00:30:02/) {$hdr||=$_;($trl=$_)=~m/(^\w{3}\s.+\d{4}$)/;next unless /^\d/;$s2+=$F[2];$s3+=$F[3]};END{print join " ","Total $hdr => $trl kr/s ",$s2,"kw/s",$s3}' file
Total Wed Jul 9 00:29:55 2008 => Wed Jul 9 00:30:02 2008 kr/s 277.1 kw/s 1714.3
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2008 01:16 PM
тАО07-09-2008 01:16 PM
Re: need script to add kr/s and kw/s columns for a specific time window
...and as a more general snippet (albeit without argument checking):
# perl -nale 'BEGIN{$beg=shift;$end=shift};if (/$beg/../$end/) {$hdr||=$_;($trl=$_)=~m/(^\w{3}\s.+\d{4}$)/;next unless /^\d/;$s2+=$F[2];$s3+=$F[3]};END{print join " ","Total $hdr => $trl kr/s ",$s2,"kw/s",$s3}' 30:00 30:02 file
Total Wed Jul 9 00:30:00 2008 => Wed Jul 9 00:30:02 2008 kr/s 277.1 kw/s 1497.7
...That is, pass three arguments, the beginning range, the ending range, and the name of the file containing the data.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2008 06:03 PM
тАО07-09-2008 06:03 PM
Re: need script to add kr/s and kw/s columns for a specific time window
Having following:
0:29:20
0:29:21
0:29:22
0:29:23
0:29:25
0:29:26
0:29:27
0:29:28
0:29:29
0:29:30
0:29:31
0:29:32
0:29:33
0:29:34
0:29:36
0:29:37
0:29:38
0:29:39
0:29:40
0:29:41
0:29:42
0:29:43
How to get:
0:29:20 0:29:21
0:29:21 0:29:22
0:29:22 0:29:23
0:29:23 0:29:25
0:29:25 0:29:26
0:29:26 0:29:27
0:29:27 0:29:28
0:29:28 0:29:29
0:29:29 0:29:30
0:29:30 0:29:31
0:29:31 0:29:32
0:29:32 0:29:33
0:29:33 0:29:34
0:29:34 0:29:36
0:29:36 0:29:37
0:29:37 0:29:38
0:29:38 0:29:39
0:29:39 0:29:40
0:29:40 0:29:41
0:29:41 0:29:42
0:29:42 0:29:43
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-09-2008 11:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2008 01:50 AM
тАО07-10-2008 01:50 AM
Re: need script to add kr/s and kw/s columns for a specific time window
0:29:20
And you can also use awk to read two at a time:
awk '
{
getline second
print $0, second
}' file
>Arturo: you can use the Unix command paste.
paste(1) seems to want to put them all on one line.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2008 04:41 AM
тАО07-10-2008 04:41 AM
Re: need script to add kr/s and kw/s columns for a specific time window
00:29:19 00:29:20
00:29:21 00:29:22
00:29:23 00:29:25
00:29:26 00:29:27
00:29:28 00:29:29
00:29:30 00:29:31
00:29:32 00:29:33
00:29:34 00:29:36
00:29:37 00:29:38
00:29:39 00:29:40
00:29:41 00:29:42
00:29:43 00:29:44
...
Instead of:
0:29:20 0:29:21
0:29:21 0:29:22
0:29:22 0:29:23
0:29:23 0:29:25
0:29:25 0:29:26
0:29:26 0:29:27
0:29:27 0:29:28
0:29:28 0:29:29
0:29:29 0:29:30
0:29:30 0:29:31
0:29:31 0:29:32
0:29:32 0:29:33
0:29:33 0:29:34
0:29:34 0:29:36
0:29:36 0:29:37
0:29:37 0:29:38
0:29:38 0:29:39
0:29:39 0:29:40
0:29:40 0:29:41
0:29:41 0:29:42
0:29:42 0:29:43