- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: from horizon text format into vertical text fo...
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
тАО06-24-2009 08:34 AM
тАО06-24-2009 08:34 AM
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
12 0 0 0 0 0 0 18k 0 0 0 0 0 0 0 0
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0 22m 0 0 0 0 0 0 0 0 0 0 17k 0 0 0
Total
23m
set 2.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1m 0 0 0 0 0 0 800k 0 0 0 0 0 0 0 0
16 17 18 19 20 21 22 23 24 Total
0 0 200k 0 0 0 0 0 0 2m
each set, number of columns will be dynamicly output from other scripts, but will end with "Total" column, for example, how do i convert set 1 into,
0:12
1:0
.
.
.
7:18k
.
.
.
17:22m
.
28:17k
.
Total:23m
and set 2 into
0:1m
.
.
7:800k
.
.
18:200k
.
.
Total:2m
shell script is prefer, thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2009 09:13 AM
тАО06-24-2009 09:13 AM
Re: from horizon text format into vertical text format
This appears to meet your needs:
# cat ./reformat#!/usr/bin/awk -f
/^Total/ {print;next;print;next}
/^[ ]*$/ {next}
{
LINE1=$0
n=split(LINE1,a," ")
getline LINE2
m=split(LINE2,b," ")
for (i=1; i
...
Run as:
# ./reformat file
...where "file" contains a set of data as shown.
Note that in the regular expression:
^[ ]*$/
the whitespace consists of a blank character followed by a TAB character. This skips blank lines in the input.
Regards!
...JRF...
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2009 09:48 AM
тАО06-24-2009 09:48 AM
Re: from horizon text format into vertical text format
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
=============================================
12 0 0 0 0 0 0 18k 0 0 0 0 0 0 0 0
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
=============================================
0 22m 0 0 0 0 0 0 0 0 0 0 17k 0 0 0
Total
=========
40m
same output. how do i skip "=", must using grep -v "=" ? Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2009 09:56 AM
тАО06-24-2009 09:56 AM
Re: from horizon text format into vertical text format
grep -v excludes the search parameter.
Only use grep -v for excludes. Use other options for grep to give you equals.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2009 10:13 AM
тАО06-24-2009 10:13 AM
Solution> same output. how do i skip "=", must using grep -v "=" ?
No, 'awk' has all the power of 'grep' and more!
# cat ./reformat
#!/usr/bin/awk -f
/^Total/ {print;next;print;next}
/^[ ]*$/ {next}
{
LINE1=$0
n=split(LINE1,a," ")
getline LINE2
if (LINE2~/======/) {next;getline LINE2}
m=split(LINE2,b," ")
for (i=1; i
...run as:
# ./reformat file
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2009 10:24 AM
тАО06-24-2009 10:24 AM
Re: from horizon text format into vertical text format
> SEP: Only use grep -v for excludes
Yes, and that's exactly what he wants to do. My point in _not_ using 'grep' was why have an extra process when 'awk' can do it all?
However, if Matthew wanted to use my original solution he could have done:
# grep -v "======" file | ./reformat
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-24-2009 10:48 AM
тАО06-24-2009 10:48 AM
Re: from horizon text format into vertical text format
JRF reads my mind and interprets what I meant to say. He's da man.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 05:25 AM
тАО09-24-2009 05:25 AM
Re: from horizon text format into vertical text format
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Total
==============================================================================================
slot 9: 144m 0 212m 67m 123 0 789 0 0 0 0 0 0 0 0 0 423m
and reformat into
slot 9/16: 144m
slot 9/17: 0
slot 9/18: 212m
slot 9/19: 67m
.
.
.
slot 9/Total: 423m
possible ? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 05:27 AM
тАО09-24-2009 05:27 AM
Re: from horizon text format into vertical text format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-24-2009 06:15 AM
тАО09-24-2009 06:15 AM
Re: from horizon text format into vertical text format
Given your posted input, you could use the attached Perl script.
Run as:
# ./reformat file
Regards!
...JRF...