VOLUMES eu-west-1b 90 30 snap-54d6abac in-use vol-a60879a4 gp2
VOLUMES eu-west-1b 150 50 snap-8218247a in-use vol-6ee29c6c gp2
VOLUMES eu-west-1b 50 snap-8518247d in-use vol-76e29c74 standard
VOLUMES eu-west-1b 300 100 snap-bcef1047 in-use vol-d22167d0 gp2
VOLUMES eu-west-1b 30 snap-1e3ec2e6 in-use vol-98efba9a standard
VOLUMES eu-west-1b 24 8 snap-1b3ec2e3 in-use vol-99efba9b gp2
VOLUMES eu-west-1b False 24 8 snap-1b3ec2e3 available vol-4691b244 gp2
I have the below script that returns the above result /usr/bin/aws ec2 describe-volumes --output text | /bin/grep "VOLUME"
I am trying to extract only the column (8) - i.e. words that start with vol-
/usr/bin/aws ec2 describe-volumes --output text | /bin/grep "VOLUME" | /usr/bin/awk '{ print $6 }'
I did the following change but this returns
in-use
in-use
vol-76e29c74
in-use
vol-98efba9a
in-use
in-use
vol-6591b267
vol-01c6e403
in-use
in-use
vol-0e416c0c
vol-d1f28684
vol-f7d5a2a2
vol-84f4eca8
available
Because column 5 is blank for some of the lines - so the result looks incorrect.
Can some one point me on how to extract only strings starting with 'vol-'
I don't want to use perl - since I am not sure if the library is installed, I need to use egrep or awk.
regards D