BladeSystem Forums have moved here
To make BladeSystem information easier to find, we have moved the BladeSystem forums here, to Servers and Operating Systems.
Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Help with scripting issue ...

SOLVED
Go to Solution
Super Advisor

Help with scripting issue ...

I am issuing a setboot command to capture my Primary and Secondary boot devices which I am interested in the following lines:

 

Primary bootpath : 0/0/0/2/0/0/0.0x0.0x1010000c0000000 (/dev/rdisk/disk2)
HA Alternate bootpath : 0/0/0/2/0/0/0.0x0.0x1000000c0000000 (/dev/rdisk/disk3)

 

From this is there a way in a script to pick out just the 'disk2' and 'disk3' from each line ??

 

 

4 REPLIES
Highlighted
Acclaimed Contributor

Re: Help with scripting issue ...

Hi:

 

One quick way:

 

# setboot | perl -nle 'm{rdisk/(\w+)} and print $1'

 Regards!

 

...JRF...

Super Advisor

Re: Help with scripting issue ...

nks you, I never think about using perl....

Acclaimed Contributor

Re: Help with scripting issue ...

Hi (again):


MikeL_4 wrote:

nks you, I never think about using perl....


And I *always* think Perl first :-)

 

To assign kudos, you need to explictly toggle them.  Marking a post as "solved" [which is a very appropriate thing to do] is a *separate* action.

 

Regards!

 

...JRF...

Acclaimed Contributor

Re: Help with scripting issue ...

[ Edited ]

>I never think about using perl

 

You could also use sed to select the token between "rdisk/" and ")".  Something like:

sed -e '/rdisk/ s:.*rdisk/\([^)]*\)):\1:' file

 

Actually some slight changes:

sed -n -e '/rdisk/ { s:.*rdisk/\([^)]*\)):\1:; p; }' file