开发者

Regex for swap info in AIX mahine

开发者 https://www.devze.com 2023-03-17 15:43 出处:网络
swap info command in AIX : lsps -a swap info output in AIX : Page SpacePhysical VolumeVolume GroupSize %Used ActiveAutoType

swap info command in AIX : lsps -a

swap info output in AIX :

Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type
paging00        hdisk1            rootvg        5120MB    63   yes   yes    lv
hd6             hdisk1            rootvg        4992MB    65   yes   yes    lv

How can i get the Size and %Used values?

something like

5120MB    63
4992MB    65

Updated Here is what i did

lsps -a | awk '{print $4" "$5}'

which gets me

Volume Volume
5120MB 63
4992MB 65 

I don't want the 1st line Volume Volume. I might do lsps -a | awk '{print $4" "$5}'|tail -2 but there can be more than 2 rows :)开发者_如何学Go


This awklette should do it.

lsps -a | awk '$1 != "Page"  { print $4 " " $5 }'

You can achieve the same thing with "cut" or "sed" but Ive alway found awk more readable and reliable.

In response to comment requesting resources:

A collection of nifty one liners is found here here

And some more in depth documentation is here

and a good tutorial is here


This line should do what you need:

lsps -a | grep -oi '[0-9]+[a-z]+[ \t]+[0-9]+'
0

精彩评论

暂无评论...
验证码 换一张
取 消