in reply to Re: Regex and PID issue
in thread Regex and PID issue

Thanks for the breakdown on the regex, I am new to it. I agree with you and the simplification. The problem I have is with $1. The value in there is missing the last digit.

Replies are listed 'Best First'.
Re^3: Regex and PID issue
by stevieb (Canon) on Jun 16, 2016 at 18:47 UTC

    Did you actually read my post? Did you try my code? Did you compare my output to the actual command line output?

      I've resolved it with your help, see below:

      if ($line =~ qr|$owner\s+(\d+).*$processName|)

      The line above wound up being the winner.

      The line I was parsing is below, however it is abbreviated because the other JVM params and classpath show up after that. That's why the trailing $ didn't work. Don't know why the whitespace character before the processName didn't work.

      firtdev3 23052 0.3 0.3 5914496 419300 ? Sl 12:41 0:29 /opt/ +streets/vendorLib/java/linux/jdk1.7.0_45/bin/java -DprocessName=STP_I +NBOUND_INTERFACES.3
      I did run it. The regex doesn't match the output on a Red Hat system. I don't really have a problem with the expression.

        You can help us help you better by providing actual, representative output you get on your system.

        This allows us to work with the code without having to guess what the input data actually looks like.

        I apologize I came off seemingly aggressive... I should have known better that not all systems have the same output, and should have requested it like Corion.

        Glad you got it resolved.