Formatting the output from tail

If you need to monitor a log file in real time, then using a combination of tail and grep will allow you to watch the important parts of the file. However if the log file spans more than one line then it can quickly become difficult to read.

By using sed you are able to format the text so it is easier to read like this

tail -f /path/to/file | sed -u G | grep -A 1 searchTerm


Tags: greploggingbashsedtail