I run the following command.
ps -e -o args | grep destiny | grep UNIX
I receive the following output.
/path/to/destiny -r -m UNIX -t TCP -p 1501
What command can I use the get the value of the printed arguments (for example
-p)? I would like to achieve the following.
ps -e -o args | grep destiny | grep UNIX | <someCommand> -p this should print
ps -e -o args | grep destiny | grep UNIX | <someCommand> -m this should print
ps -e -o args | grep destiny | grep UNIX | <someCommand> -t this should print
Please note that
-t may switch columns so printing with
awk and choosing column by number is not an option.
Some more facts so that the parsing gets easier (I know it's possible I just lack the tooling knowledge).
- if an option is not present an empty string will be returned
- options that will be parsed will always have an argument/a value in this particular case