0

Confused as to why this:

sudo ps aux | grep -E '\/erts-[1-9]\d*(\.\d+)+\/bin\/beam'

Does not return a match for the beam.smp process of the form:

/opt/api_presence/erts-8.3/bin/beam.smp

All regex testers/validators confirm this returns the expected output given what was put in. At the very least you can test with /bin/beam.

In the comments, user muru has identified my issue.

Kahn
  • 1,702
  • 2
  • 20
  • 39
  • 1
    Your regex testers aren't testing for grep, so they're useless. \d needs GNU grep with -P. The / doesn't need to escaped. – muru Nov 11 '19 at 14:57
  • Terrific - thanks for the clarity, muru. – Kahn Nov 11 '19 at 15:03
  • Comment via user muru has corrected my issue. – Kahn Nov 11 '19 at 15:04
  • 1
    The right thing to do here is to either write the entire solution in the Answer box, or to accept the proposed duplicate as having solved your problem. Using the Answer box to say "a comment solved it" is Not An Answer... – Jeff Schaller Nov 11 '19 at 15:44

1 Answers1

1

The -P flag was needed.

sudo ps aux | grep -P '\/erts-[1-9]\d*(\.\d+)+\/bin\/beam' has returned the proper result

Kahn
  • 1,702
  • 2
  • 20
  • 39