awk to split and parse unpredictable data

data.txt:

CRITICAL: iLash: 97.00%, SqlPlus: 99.00%. Warning/critical thresholds: 95/98%

I need to pull only the disknames:

iLash and SqlPlus

The following command will only pull iLash:

echo "CRITICAL: iLash: 97.00%, SqlPlus: 99.00%. Warning/critical thresholds: 95/98%" | awk -F":" '{print $2}' | sed 's~ ~~g' 

the data in data.txt is unpredictable. in this particular data which i posted, there's only two disk names alerting.

sometimes there will be more or less. i need help with an awk command that will only spit out the disk names.

Like this ?

echo "CRITICAL: iLash: 97.00%, SqlPlus: 99.00%. Warning/critical thresholds: 95/98%" | awk -F'[ :,]' ' { print $3,$7} '

output:

iLash SqlPlus

How then to know when a valid disk name is present?
I am thinking to look immediately prior to

: xx.xx%

doesn't seem be working. it's only grabbing the number of columns it is told to grab.

echo "CRITICAL: iDash: 97.00%, iGash: 97.00%, iTash: 97.00%, SQLPlus: 99.00%. Warning/critical thresholds: 95/98%" | awk -F'[ :,]' ' { print $3,$7} '

output:

iDash iGash

Why don't you show more data ? what greet_sed posted works fine for given data

For your data in post#4, try

echo "CRITICAL: iDash: 97.00%, iGash: 97.00%, iTash: 97.00%, SQLPlus: 99.00%. Warning/critical thresholds: 95/98%" | sed -r 's/^[^:]*:|\. .*$|: [0-9.]*%//g'
 iDash, iGash, iTash, SQLPlus

I am not sure that what you expect really... for given input in #1 and #4 this will work

$ awk 'gsub("CRITICAL|[0-9.:%  ]|Warning.*",x)' file

for input in #1

$ echo "CRITICAL: iLash: 97.00%, SqlPlus: 99.00%.  Warning/critical thresholds: 95/98%" | awk 'gsub("CRITICAL|[0-9.:%  ]|Warning.*",x)'
iLash,SqlPlus

for input in #4

$ echo "CRITICAL: iDash: 97.00%, iGash: 97.00%, iTash: 97.00%, SQLPlus: 99.00%. Warning/critical thresholds: 95/98%" | awk 'gsub("CRITICAL|[0-9.:% ]|Warning.*",x)'
iDash,iGash,iTash,SQLPlus

this worked! Thank you!!!

---------- Post updated at 01:40 PM ---------- Previous update was at 01:39 PM ----------

this worked too. just needed to modify it a bit.