Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 721729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:54:26+00:00 2026-05-14T05:54:26+00:00

I have a log file containing statistics from different servers. I am separating the

  • 0

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?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:54:26+00:00Added an answer on May 14, 2026 at 5:54 am

    Do you need to recognize the line as well, or only extract the value, i.e. do you expect some unrelated lines? If not the answer is
    /^(?:[^,]+,){9}([^,]+)/'
    this will extract the tenth field from some comma separated list

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a log file that I'm trying to append data to the end
I have a huge log file containing log messages prefixed with timestamp. The timestamp
I have a remote javascript file containing a custom jQuery event handler. When this
I have a log file containing search queries entered into my site's search engine.
I have a log file containing the following data: Shortest path(2)::RV3280-RV0973C-RV2888C Shortest path(1)::RV3280-RV2502C Shortest
I need to extract requests from a log file that look like this :
I have a CSV file containing log on data for users and would like
I have a log file that I am reading to a string public static
I have a log file in SqlServer that stores the time an application started,
Lets say we have a log file (preferably a txt file) available in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.