I have a log file containing statistics from different servers. I only separate statistics from this log file with a regular expression. I am trying to grab CPU usage from a running process. For SunOS, I have below:
process,10050,user1,218,59,0,1271M,1260M,sleep,58.9H,0.02%,java
Here CPU% is in the 11th field if we separate it with commas (,). This field has a% sign, which is unique, and I can use below regex. To get this value:
regex => q/^process,(?:.*?),((?:\d+)\.(?:\d+))%,java$/,
For Linux system I have below:
process,26190,user1,20,0,1236m,43m,6436,S,0.0,1.1,0:00.00,java,
Here, the CPU usage is in the 10th column, but without the% sign, and there is nothing unique in this field.
What regular expression pattern should I use to get this value?