- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: A fun little awk help. Legacy device getter.
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-05-2011 03:20 PM
тАО04-05-2011 03:20 PM
disk 29 0/6/2/0.151.15.23.0.0.4 sdisk CLAIMED DEVICE IBM 2145
/dev/dsk/c19t0d4 /dev/rdsk/c19t0d4
That is standard 11.23 ioscan.
I have the -H hardware device.
0/0/1/1.15.0
Which I got from setboot
I am needing the legacy device. Can't use ioscan -m because that useful little tool does not exist.
It will look kind of like:
I can't get the awk working today.
ioscan -kfnC fc | awk тАШ/fcd/ {getline;fcd=$NF;print fcd,$2}тАЩ | while read -r fdev
do
fcmsutil ${fdev} | awk тАШ/Hardware / {print $5};/World / { print $7}тАЩ
done
Something like:
ioscan -kfnCdisk | awk '/$pboot/ {getline;fcd=$pboot; print fcd,$2}'
Except maybe something that works.
SEP
Was thinking:
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Solved! Go to Solution.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2011 03:54 PM
тАО04-05-2011 03:54 PM
Re: A fun little awk help. Legacy device getter.
> ioscan -kfnCdisk | awk '/$pboot/ {getline;fcd=$pboot; print fcd,$2}'
If you are attempting to pass 'pboot' as a variable, this isn't gong to work. You should do something like:
# ioscan -kfnCdisk | awk -v pboot=${pboot} '$0~pboot {getline print pboot,$2}'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 07:48 AM
тАО04-06-2011 07:48 AM
Re: A fun little awk help. Legacy device getter.
ioscan -kfnCdisk | awk -v pboot=${pboot} '$0~pboot {getline print pboot,$2}'
I get the concept.
awk: The statement cannot be correctly parsed.
The source line is 1.
I'm hacking away here.
This looks almost done.
Steven
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
тАО04-06-2011 08:13 AM
тАО04-06-2011 08:13 AM
Re: A fun little awk help. Legacy device getter.
ioscan -kfnCdisk | awk -v pboot=${pboot} '$0~pboot {getline;print pboot,$2}'
Chime in JRF for full pointage.
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
тАО04-06-2011 08:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 11:22 AM
тАО04-06-2011 11:22 AM
Re: A fun little awk help. Legacy device getter.
# ioscan -kfnCdisk | awk '/'$pboot'/ {getline;fcd='$pboot'; print fcd,$2}'
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 11:59 AM
тАО04-06-2011 11:59 AM
Re: A fun little awk help. Legacy device getter.
abootdisk=$(ioscan -kfnCdisk | awk -v aboot=${aboot} '/aboot/ $0~aboot {getline;print aboot,$2}' | awk '{ print $2 }');
That is the final version.
Done, assigning points.
awk is awkful
awk is fun, more than enough for anyone.
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
тАО04-06-2011 12:21 PM
тАО04-06-2011 12:21 PM
Re: A fun little awk help. Legacy device getter.
why did you use both /aboot/ and $0~aboot ? both says "if the line contains the value of the variable aboot, do this..."
and why did you give the output to a second awk statement? (which could be done inside the first awk) that seems to me a performance hog.
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 12:25 PM
тАО04-06-2011 12:25 PM
Re: A fun little awk help. Legacy device getter.
I will award points for working more efficient code.
The statement executes twice as part of a process that chooses alternate boot disk to be broken out of a two disk root/boot mirror set as a target for a DRD clone.
If it were executing hundreds of times, I would work harder on efficiency.
Its not, so I stopped. I am not averse to a theoretical exercise to improve the code.
The current code is the top new post at http://hpux.ws
I would love to tune it up and make it more awkful.
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
тАО04-06-2011 09:14 PM
тАО04-06-2011 09:14 PM
Re: A fun little awk help. Legacy device getter.
I'm not sure what both really do together?
>both says "if the line contains the value of the variable aboot"
No, /aboot/ says look for the constant RE containing "aboot", not the variable. That's why JRF switched $0 ~ aboot
>why did you give the output to a second awk statement?
(I assumed the extra token was to make sure it worked?)
Not really done, just changed: :-)
... | awk -v aboot=${aboot} '$0 ~ aboot {getline; print $2}')