I have a log file containing statistics from different servers. I am separating the statistics from this log file using regex only. 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 commas (,). This field has % sign which is unique and I can use below regex To get this value:
regex => q/^process,(?:.*?),((?:\d+)\.(?:\d+))%,java$/,
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 but without % sign and there is nothing unique I can see with this field.
What regex pattern should I use to get this value?