Quantcast
Channel: UNIX and Linux Forums - AIX
Viewing all articles
Browse latest Browse all 373

Simple AWK cleanup/questions AIX

$
0
0
I have an unfortunate need to redo a bunch of disk settings on a VIOS on AIX, so I was putting together a quick script to scrub everything it has, make the changes, and then put the mappings back. It works, I just am trying to get my awk a bit more up-to-snuff and wanted to know the proper way to conjoin my awk statements

Initial Output:
Code:

$ lsmap -vadapter vhost3
vhost3          XXXXX.XXX.XXXXXXXX-XX-XXX                    0x00000007

VTD                  xxxx_datavg1
Status                Available
LUN                  0x8400000000000000
Backing device        hdisk41
Physloc              XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Mirrored              false

VTD                  xxxx_rootvg1
Status                Available
LUN                  0x8500000000000000
Backing device        hdisk44
Physloc              XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Mirrored              false

VTD                  xxxx_rootvg2
Status                Available
LUN                  0x8600000000000000
Backing device        hdisk45
Physloc              XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Mirrored              false

What I have (and desired output)
Code:

$ lsmap -vadapter vhost3| awk '/^VTD|^Backing/' | awk 'ORS=NR%2?FS:RS'| awk '{print $2,$5}'
xxxx_datavg1 hdisk41
xxxx_rootvg1 hdisk44
xxxx_rootvg2 hdisk45

Learning awk hack and slash as I go, and I'm sure missing important fundamentals, but would appreciate the help on cleaning this up into a coherent single awk call.

Viewing all articles
Browse latest Browse all 373

Trending Articles