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 8530147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:11:36+00:00 2026-06-11T09:11:36+00:00

I need to parse some info out of a big nasty ps string. I

  • 0

I need to parse some info out of a big nasty ps string. I need to get the username and PID, then the /usr/user/java.instanceName/ part into one line.

I tried grep, sed and awk, but I dont know any of them that well. And after hours of reading for this simple task, I’m hoping someone can just tap out a quick one liner.

This is the last thing I tried before asking:

ps auxwww | sed 's/^[a-z]* *[0-9]*//g;s/\/usr\/user\/[a-z._0-9]*//g'

Here is the std out from the ps auxwww command:

root 3837 2.5 32.5 4697784 2657720 ? Sl Sep13 30:23
/usr/java/jdk16/bin b.WebService.port=80
-Dorg.jboss.naming.NamingService.port=90 -Dorg.jboss.na mi.port=90 -Dorg.jboss.invocation.jrmp.server.JRMPInvoker.port=40
-Dorg.jbos server.PooledInvoker.port=41 -Dorg.jboss.remoting.transport.Connector.port=42 ing.transport.Connector.messaging.port=180
-Dorg.jboss.remoting.transport.Conn 1 -Djboss.bind.address=10.0.0.1 -Dtomcat.bind.address=10.0.0.1 -Dtomca cat.https.port=443 -Djava.net.preferIPv4Stack=true
che.cluster.name=cluster =INVALIDATION_ASYNC
cache.mcast.port=457 -Dejb3.cache.mode=LOCAL
-Dejb3.cache.cluster.name=EJB3-en ss.platform.mbeanserver
-Djavax.management.builder.initial=org.jboss.system.serv ilderImpl -server -Dsun.security.ssl.allowUnsafeRenegotiatio
ed.dirs=/usr/user/java.instanceName/lib/endorsed
-Dsun.rmi.dgc.client.gcInte mi.dgc.server.gcInterval=3600000
-Djavax.net.ssl.trustStore=/usr/java/jdk16/jre/ -Djavax.net.ssl.trustStorePassword=pass123 -Djavax.net.ssl.trustStoreType=JKS pGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseParNewG m -XX:PermSize=512m -XX:MaxPermSize=512m -jar run.jar -c jvmname -b 10.0.1.1

  • 1 1 Answer
  • 0 Views
  • 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-06-11T09:11:38+00:00Added an answer on June 11, 2026 at 9:11 am

    I think this should work:

    ps auxww | sed -n -e '/java.instanceName/s;\(^[a-z]* *[0-9]*\).*\(/usr/user/java.instanceName[A-Za-z._0-9/]*\) .*;\1 \2;p'
    

    That breaks down like this: sed -n turns off the default print action on every line; /java.instanceName/ will pick only lines that have that pattern in it; the s command uses ; as a delimiter because / is used later in the pattern; \(^[a-z]* *[0-9]*\) is as you had it and matches the user and PID at the beginning of the line, but with the additional effect of saving exactly what was matched; then we skip everything up until \(/usr/user/...[A-Za-z._0-9/]*\) which matches a path prefixed by /usr/user/ (I tweaked the character class to include uppercase and the /) – that is saved for future use; finally the space after that path and everything else are matched. The ;\1 \2;p part replaces the entire match with the two sub-parts we saved and prints it out.

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

Sidebar

Related Questions

I need to parse a XML String so I can use some of the
I have some sort of recursive function, but I need to parse a string,
I'm reading in a huge HTML string that has some info I need to
I need to parse some text in a UITextField and turn it into a
I need parse through a file and do some processing into it. The file
Using Ruby, I'm trying to parse some documentation in which I need to split
Hi I need parse and deserialize pseudo JSON string. Input data: {aBubbleData[ 'jaja2581' ]={
I need to parse a duration string, of the form 98d 01h 23m 45s
Perl newbie here. I have a log file that I need to parse out
I need to parse C#, Ruby and Python source code to generate some reports.

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.