Comments (7)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 aldridged commented Permalink

Great post as always brian. Slight typo in the last script (Should be device and not adapter) . Not seen the past - - before ......Dan

2 Gabriel.Menini commented Permalink

Excellent, here at the office we simply grep'ed the out put but now I am going to suggest adding your command as an alias.A little suggestion, use tab in the awk formatting: '{print $5 "\t" $12}'. Cheers!

3 brian_s commented Permalink

Thanks Dan - I fixed the typo. <div>&nbsp;</div> Gabriel - Great suggestion regarding the tab for awk. I updated the post with this.

4 lech77 commented Permalink

Mixing grep and awk in an oneliner is most cases not necessary. Try this instead: <div>&nbsp;</div> pcmpath query device | awk '$1 == "DEV#:" { hdisk = $5 } $1 == "SERIAL:" { print hdisk "\t" $2 }' | sort -k 1.6b,1n <div>&nbsp;</div> Or, if you expect hdisk numbers longer than two digits and would like to have visually nice ouptut, try this: <div>&nbsp;</div> pcmpath query device | awk '$1 == "DEV#:" { hdisk = $5 } $1 == "SERIAL:" { printf( "%-8s %s\n", hdisk, $2 ) }' | sort -k 1.6b,1n

5 kappa commented Permalink

pcmpath query device | perl -00 -ne 'print /NAME: (\w+ )|SERIAL: (\w+)/g,"\n"' <div>&nbsp;</div> greetings from Vienna <br /> Hannes

6 brian_s commented Permalink

lech77 and kappa - thanks for sharing ideas on how you would do this in Awk and Perl. It's cool to see different people's solutions to the same question/problem!

7 KelleyCook commented Permalink

This one doesn't require sddpcm. <div>&nbsp;</div> for DISK in $(lsdev -Cc disk -F name);do printf $DISK" ";lsattr -El $DISK -F value -a unique_id | cut -c6-37;done