TSM Topics Feed

Thursday, May 26, 2011

Get Device Info From AIX

I needed to gather the serial numbers by device (rmt) in AIX for our VTL, and the grep command in AIX is not as functional as my Linux box at home, so the -A and -B options are not available. Those two flags allow you to grab X lines before and after the grep'ed expression which is really handy when running lscfg -vp. Here's a grep command to gather just the rmt(s) with their serial and WWN. If you need to change the number of lines just change the a (after) and b (before) value, and s is what is "grep'ed".

lscfg -vp | awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=1 a=5 s="rmt"

No comments:

Post a Comment