msgbartop
Tips and Tricks site for advanced HP-UX Engineers
msgbarbottom

06 Nov 13 Getting EMC disk ID’s.

We want storage to check performance on three possibly problematic LUNS.

Need to get the 4 character LUN ID’s on three disks:

disk82 disk83 and disk123

/usr/bin/inq -nodots -sym_wwn | egrep “disk82|disk83|disk123″| awk ‘{print $3}’ |awk ‘{ print substr( $0, length($0) – 3, length($0) ) }’

Output:

5422

5423

5826

HP-UX 11.31 September 2011 OE.

A good day is an awkful day.

Tags: , , , , ,

30 Nov 10 awk trick of the day. Parsing comma delimited input to a sequential file

Lets say I have a list of servers a mile long to visit.  Got a help desk request with the servers listed separated by commas.

server1,server2,server3

Lets say It is actually about 30 or 40 servers and I’m too lazy to edit the list

echo “server1,server2,server3” > olist

awk -F, -v nr=1 ‘{ for (x=nr; x<=NF; x++) {printf $x ” \n”; }; print ” ” }’ olist

Output:

server1

server2

server3

Plug and play time here, you can take care of any delimited format like this.

Spaces input by wordpress (thanks)

Tags: , ,

sidebarbottom
sidebartop
sidebarbottom
WhatsApp chat