Reputation: 63
after doing the command in the terminal: forever list
i get the following output:
info: Forever processes running
data: uid command script forever pid logfile uptime
data: [0] 0ClV node enfomo-server.js 376 377 /Users/USERNAME/.forever/0ClV.log 0:0:37:26.987
i need to use grep or some alternative to give as output the following string only:
/Users/USERNAME/.forever/0ClV.log
what is the proper command?
Upvotes: 2
Views: 6299
Reputation: 22850
You can do this with grep using the -o
flag which only prints the matching part:
forever list | grep -o '\/Users.*log'
Upvotes: 3
Reputation: 14925
First you might want to isolate only the lines you want with grep, then awk would work:
grep node file | awk '{print $7}'
or cut:
grep node file | cut -d\ -f7
Upvotes: 2