What I want to do:
Parse the output from a verbose "grep" command and get just certain pieces of information.
Sample output from grep:
user123 12101 <variable collection of unwanted stuff> -nproduction_WebLive <maybe more unwanted stuff>
The problem:
I want the pid (here "12101") which is always field 2 using the standard awk delimiter of spaces, but I also want to grab that which is preceded by "-n" and it is not always in the same spot. I know about using "-F" to specify a different delimiter, but have not figured out how to switch delimiters after grabbing the desired pid.
Desired output:
Using the above example, I would like to see "12101 production_WebLive
Parse the output from a verbose "grep" command and get just certain pieces of information.
Sample output from grep:
user123 12101 <variable collection of unwanted stuff> -nproduction_WebLive <maybe more unwanted stuff>
The problem:
I want the pid (here "12101") which is always field 2 using the standard awk delimiter of spaces, but I also want to grab that which is preceded by "-n" and it is not always in the same spot. I know about using "-F" to specify a different delimiter, but have not figured out how to switch delimiters after grabbing the desired pid.
Desired output:
Using the above example, I would like to see "12101 production_WebLive