/ Published in: Bash
When tailing a log file, its sometimes handy to only show parts of it that you are interested in, this simple pipe does the job.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
tail -f /myFile.log | grep 'string_to_find' # for a log file # 1: hello # 2: string_to_find on line 2 # 3: hello again # the command above will output: # string_to_find on line 2 # to do an invert match just use -v with grep # tail -f /myFile.log | grep -v 'string_to_ignore'