-2

When attempting to use awk to get the process ID from the output of ps aux like so:

ps aux | awk "{ print $2 }"

No matter what number of row I attempt to print, awk always outputs the full line. I've never managed to get it to work properly. I'm using macOS which apparently uses a different type/version of awk, but I can't find an alternative syntax which might work.

Any advice would be greatly appreciated!

jonlambert
  • 432
  • 7
  • 14

1 Answers1

1
ps aux | awk '{ print $2 }'

Try that one

DevMops
  • 101
  • 1
  • 8