- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- parse output from the following
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
тАО04-14-2011 05:47 AM
тАО04-14-2011 05:47 AM
Pseudo name=emcpower259a
Logical device ID=0113
state=alive; policy=SymmOpt; priority=0; queued-IOs=0
==============================================================================
---------------- Host --------------- - Stor - -- I/O Path - -- Stats ---
### HW Path I/O Paths Interf. Mode State Q-IOs Errors
==============================================================================
3075 pci@8,600000/SUNW,qlc@1/fp@0,0 c2t5006048C53688940d132s0 FA 1cA active alive 0 0
3072 pci@8,600000/SUNW,qlc@2/fp@0,0 c3t5006048C5368894Fd132s0 FA 16cA active alive 0 0
Pseudo name=emcpower255a
Logical device ID=0117
state=alive; policy=SymmOpt; priority=0; queued-IOs=0
==============================================================================
---------------- Host --------------- - Stor - -- I/O Path - -- Stats ---
### HW Path I/O Paths Interf. Mode State Q-IOs Errors
==============================================================================
3075 pci@8,600000/SUNW,qlc@1/fp@0,0 c2t5006048C53688940d133s0 FA 1cA active alive 0 0
3072 pci@8,600000/SUNW,qlc@2/fp@0,0 c3t5006048C5368894Fd133s0 FA 16cA active alive 0 0
The output from the above will give just two column, first is the pseudo name and second is a logical device id
for example, the output from the above will be
259 0113
255 0117
notice that it also strip off the emcpowerxxxa from it too. Look like there is no simple way to do this in a shell script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 05:54 AM
тАО04-14-2011 05:54 AM
SolutionThis should give you 259a and 255a from the output above
cat output | grep "Logical device" |cut -d"=" -f2
output of the above should give you 0113 and 0117
Am I missing something ?
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 06:07 AM
тАО04-14-2011 06:07 AM
Re: parse output from the following
One quick way:
# cat ./myfilter
#!/bin/sh
typeset FILE=$1
awk '
/Pseudo/ {split($0,a,"=");printf "%s", a[2]}
/Logica/ {split($0,a,"=");printf " %s\n", a[2]}
' ${FILE} | sed -e 's/[^ 0-9]*//g'
...using your input:
# ./myfilter myfile
259 0113
255 0117
...or:
#
Regards!
...JRF...
./myfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 06:23 AM
тАО04-14-2011 06:23 AM
Re: parse output from the following
Actually, in the spirit of conservation of needless processes (even in pipes), you could do:
# ./myfilter
#!/bin/sh
typeset FILE=$1
awk '
/Pseudo/ {split($0,a,"=");gsub(/[^ 0-9]*/,"",a[2]);printf "%s",a[2]}
/Logica/ {split($0,a,"=");gsub(/[^ 0-9]*/,"",a[2]);printf " %s\n",a[2]}
' ${FILE}
...that is, let 'awk' due all the work it is designed to do :-)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2011 04:14 AM
тАО04-18-2011 04:14 AM
Re: parse output from the following
Are you satisfied with the help that you have received?
...JRF...