- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: convert a column to row 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
тАО07-01-2010 07:50 AM
тАО07-01-2010 07:50 AM
how do I change this column output to a single row?
from this:
# vgdisplay -v /dev/vgeva05 | grep dsk | awk '{print $3}'
/dev/dsk/c6t0d5
/dev/dsk/c11t0d5
/dev/dsk/c15t0d5
/dev/dsk/c18t0d5
/dev/dsk/c7t0d5
/dev/dsk/c10t0d5
/dev/dsk/c14t0d5
/dev/dsk/c19t0d5
to this:
/dev/dsk/c6t0d5 /dev/dsk/c11t0d5 /dev/dsk/c15t0d5 /dev/dsk/c18t0d5 /dev/dsk/c7t0d5 /dev/dsk/c10t0d5 /dev/dsk/c14t0d5 /dev/dsk/c19t0d5
any assistance would be appreciated...
manny
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2010 08:09 AM
тАО07-01-2010 08:09 AM
SolutionPersonally I would ask the question in the HPUX or a linux forum, not in an OpenVMS forum.
Anyway... I'd use something like...
vgdisplay -v /dev/vgeva05 | awk 'END {print line} /dsk/ { line = line " " $0 }'
Notice how this also cuts out the middle-man (grep )
hth,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2010 08:17 AM
тАО07-01-2010 08:17 AM
Re: convert a column to row output?
sorry about the openVMS, didn't catch it when posting...need coffee :)
tried your command, but output was impacted by "Alternate Link, etc...):
$ vgdisplay -v /dev/vgeva05 | awk 'END {print line} /dsk/ { line = line " " $0 }'
PV Name /dev/dsk/c6t0d5 PV Name /dev/dsk/c11t0d5 Alternate Link PV Name /dev/dsk/c15t0d5 Alternate Link PV Name /dev/dsk/c18t0d5 Alternate Link PV Name /dev/dsk/c7t0d5 Alternate Link PV Name /dev/dsk/c10t0d5 Alternate Link PV Name /dev/dsk/c14t0d5 Alternate Link PV Name /dev/dsk/c19t0d5 Alternate Link
from your suggestion, the following work :)
$ vgdisplay -v /dev/vgeva05 | grep dsk | awk '{print $3}' | awk 'END {print line} { line = line " " $0 }'
/dev/dsk/c6t0d5 /dev/dsk/c11t0d5 /dev/dsk/c15t0d5 /dev/dsk/c18t0d5 /dev/dsk/c7t0d5 /dev/dsk/c10t0d5 /dev/dsk/c14t0d5 /dev/dsk/c19t0d5
or
$ vgdisplay -v /dev/vgeva05 | awk '{print $3}' | awk 'END {print line} /dsk/ { line = line " " $0 }'
/dev/dsk/c6t0d5 /dev/dsk/c11t0d5 /dev/dsk/c15t0d5 /dev/dsk/c18t0d5 /dev/dsk/c7t0d5 /dev/dsk/c10t0d5 /dev/dsk/c14t0d5 /dev/dsk/c19t0d5
thank you,
manny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2010 08:27 AM
тАО07-01-2010 08:27 AM
Re: convert a column to row output?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2010 08:38 AM
тАО07-01-2010 08:38 AM
Re: convert a column to row output?
I had a typo in my answer, selecting the whole line ($0) instead of the 3rd field:
Should have been:
vgdisplay -v /dev/vgeva05 | awk 'END {print line} /dsk/ { line = line " " $3 }'
Glad you are happy,
Hein.