0

On a linux terminal

I have logs with ANSII colors like this

03-25 21:01:19.451  8067  8138 I ReactNativeJS: '\u001b[34m', '================================', '\u001b[0m'

and I would like to be able to display them with their ANSII color

> adb logcat | [magic-to-be-found]  

or better and I would like to filter and display them with their ANSII color

> adb logcat | grep ReactNative | [magic-to-be-found]

example with tail

  • this command show no colors
>tail adb.log | xargs -i -d '\n' unbuffer echo -e "{}"
04-01 20:21:06.867  5351  5421 I ReactNativeJS: '\u001b[33m', 'opened', '\u001b[0m'
04-01 20:21:07.650  5351  5421 I ReactNativeJS: '\u001b[33m', 'request :', '/AA   PUT', '', '\u001b[0m'
04-01 20:21:09.253  5351  5421 I ReactNativeJS: '\u001b[33m', 'request :', '/bb', '\u001b[0m'
04-01 20:21:16.643  5351  5421 I ReactNativeJS: '\u001b[34m', '================================', '\u001b[0m'
  • while echo of one of the lines does show right ansi color :
>echo -e "04-01 20:21:16.643  5351  5421 I ReactNativeJS: '\u001b[34m', '================================', '\u001b[0m'"
04-01 20:21:16.643  5351  5421 I ReactNativeJS: '', '================================', ''
2

1 Answer 1

0

Try to pipe your command to less -R, e.g.

tail adb.log | xargs -i -d '\n' unbuffer echo -e "{}" | less -R

see man less.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .