LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   less, ANSI colors, and search (https://www.linuxquestions.org/questions/linux-software-2/less-ansi-colors-and-search-823556/)

ryujakk 08-02-2010 08:10 AM

less, ANSI colors, and search
 
Hi,

I'm having an annoying issue with less. What I want is to view logs with important stuff color coded, and be able to correctly use less's search function.

What happens is that less correctly displays color coded text, but offsets the search highlighting.

For instance, if I run "ls -l --color=always | less -R", and then search for some text, the highlighting will be offset if that text (or any text before it) is colored.

I tried forcing LESSANSIENDCHARS by doing a "export LESSANSIENDCHARS=m", but that didn't work.

"less --version" gives me "less 382+iso254", and I am running "SUSE LINUX Enterprise Server 9 (x86_64)".

I hope I am clear enough! Any help would be greatly appreciated!

Thank you

rigor 08-03-2010 07:07 PM

I'm using konsole with TERM=xterm, under openSUSE 11.2 (x86_64) with KDE 4.3.5. If I issue the command sequence "ls -l --color=always | less -R", it appears to work just fine.

Are you saying that the ANSI control sequences aren't being handled properly? Which terminal program are you using?

cjcox 08-03-2010 07:13 PM

:-) It's a bug. Works fine on newer SLES. I'm guessing you need a newer version of less. I'd probably compile one from scratch and install in /usr/local/bin and test... just to see. If not that, then likely a terminfo issue in SLES9 or something like that.

ryujakk 08-04-2010 02:25 AM

Thanks for your answers!
I compiled the latest version of LESS, and it indeed fixed my issue. No weird highlighting anymore :-)


All times are GMT -5. The time now is 01:00 AM.