简体   繁体   中英

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?

Found a solution that works for me:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM