Home > Enterprise >  how can i print unicode characters when tailing a log?
how can i print unicode characters when tailing a log?

Time:07-21

I have log files have things like \u003c scattered throughout them. When I run a command like tail -f log.txt, I see escaped unicode characters everywhere, and am wondering what can I do to properly display these characters so I am not seeing escaped stuff?

EDIT:

>cat log.txt
{:since=\u003e2022-07-20 00:24:47.478898 UTC}
>hexdump log.txt
0000000 3a7b 6973 636e 3d65 755c 3030 6533 3032
0000010 3232 302d 2d37 3032 3020 3a30 3432 343a
0000020 2e37 3734 3838 3839 5520 4354 0a7d
000002e

CodePudding user response:

You could use printf for translating this kind of escape sequence:

tail -f log.txt |
while IFS='' read -r line; do printf '%b\n' "$line"; done

CodePudding user response:

You can pipe the output of tail -f into hexdump.

tail -f log.txt | hexdump
  • Related