linux - Parse info from bash -


I try to parse some information on bash to Ubuntu

I have to write every x seconds that writes:

always list

this response Looks like this from the command:

  information: the usual processes to run the data: UID command script forever log log file uptime data: [0] _1b2 / usr / bin / nodejs / home / Ubuntu / node / server.js 28968 28970 /root/.forever/_1b2.log 0: 0: 17: 17.233  

I want to parse the location of the logfile /root/.forever/_1b2.log

Any ideas how to complete it with Bash?

To solve this problem, two awk variations:

  # The most basic command. Awk 'NR == 3 {print $ 8}' data   


  # bit more robust: order | Awk '$ 1 == "Data:" & amp; Amp; $ 2 == "[0]" {Print $ 8} "data # ^^^^^^^^^ I filter on" [0] "text, but depending on your needs, you get $ 3 You may want to use == "_1b2" or $ 4 == "/ usr / bin / nodejs"  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -