Search code examples
linuxtail

How to apply a function to the output of tail -f?


I have a log file that continuously gets updated. I can view the file with tail -f and see all the changes as they come in. However, there is an issue - the text contains the characters \n instead of newlines. I would like to change the characters \n into actual newlines. How do I go about doing that?


Solution

  • Found a solution that works for me:

    tail -f logfile | sed 's/\\n/\
    /g'