what perl regex should I use to get value from line
- by Octopus
I am trying to capture the cpu usage from the running process. For SunOS, I have below output
process,10050,user1,218,59,0,1271M,1260M,sleep,58.9H,0.02%,java
here the cpu % is at 11th field if we separate by comma(,). To get this value I am using below regex
regex => q/^process,(?:.*?),((?:\d+)\.(?:\d+))%,java$/,
but for the linux system I have below output.
process,26190,user1,20,0,1236m,43m,6436,S,0.0,1.1,0:00.00,java,
here the cpu usage is at 10th column
What regex pattern should i use to get this value. Appreciate for any suggestion.