TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

linux pager for reading raw log files

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
davevnj



Joined: 22 Nov 2006
Posts: 55

PostPosted: Wed Jan 17, 2007 11:14 am    Post subject: linux pager for reading raw log files Reply with quote

I'm having a little trouble using "less" to view my log files in that, color codes don't seem to bleed into the next line. So I get something like:

<escaped color code>colored text
default color text that should be the same text as the previous line

is there some setting in less that tells it to allow the color to continue on the next line, or is there a better pager out there that does this? like, more, most, cat, dog, whatever...

less has always done the job in the past and I just don't feel like trying every pager under the sun if someone has a quick answer.
Back to top
View user's profile Send private message Visit poster's website
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Jan 18, 2007 8:38 am    Post subject: Reply with quote

Try: ./tt++ -e "#scan filename.log;#buffer home"
Back to top
View user's profile Send private message Send e-mail
davevnj



Joined: 22 Nov 2006
Posts: 55

PostPosted: Thu Jan 18, 2007 9:45 am    Post subject: Reply with quote

Scandum wrote:
Try: ./tt++ -e "#scan filename.log;#buffer home"

That's a step in the right direction, but of course fixes one problem just to find another.

One of the nice features in less is the find(/) and findnext(n) commands, as well as many others.

I know we have a #grep and #buffer find, but maybe we can expand the #buffer command to have a findnext and reverse find. Then I could just use macros to reproduce less' find behavior. Should I post this to the request board?
Back to top
View user's profile Send private message Visit poster's website
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Fri Jan 19, 2007 10:20 am    Post subject: Reply with quote

I think you can use #buffer find 0 text, #buffer find 1 text, etc. It's possible to write a counting macro for this.

So the general idea becomes to write your own pager in tintin. I'll add better paging support to the todo list, but it'll be low priority.

Code:

#alias {find %1 %2}
{
    #var bufferfind %1;
    #var buffertext %2;
    #buffer find %1 %2
}

#macro {\C-n}
{
    #math bufferfind $bufferfind - 1;
    #buffer find $bufferfind $buffertext
}

#macro {\C-p}
{
    #math bufferfind $bufferfind + 1;
    #buffer find $bufferfind $buffertext
}


./tt++ -e "#read pager.tin;#scan filename.log;#buffer home"
Back to top
View user's profile Send private message Send e-mail
davevnj



Joined: 22 Nov 2006
Posts: 55

PostPosted: Sun Jan 21, 2007 11:51 am    Post subject: Reply with quote

Thank you for that. Here's my slight modification:
Code:
#alias {?}
{
   #var bufferfind 0;
   #var buffertext %0;
   #buffer find $bufferfind %0
}

#nop doesn't work currently...
#alias {/}
{
   #var bufferfind -1;
   #var buffertext %0;
   #buffer find $bufferfind %0
}

#macro {\C-n}
{
   #math bufferfind $bufferfind - 1;
   #buffer find $bufferfind $buffertext
}

#macro {\C-p}
{
   #math bufferfind $bufferfind + 1;
   #buffer find $bufferfind $buffertext
}


It would be nice is negative numbers started at the top of the buffer, then the / command would work and you could search from top or bottom. But this is good enough to get the job done. Thanks for the help. Next it would be good if I could determine when I can't find any more, and have it wrap, but I don't think the effort required is worth it Coffee.
Back to top
View user's profile Send private message Visit poster's website
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Mon Jan 22, 2007 6:57 am    Post subject: Reply with quote

davevnj wrote:

It would be nice is negative numbers started at the top of the buffer, then the / command would work and you could search from top or bottom. But this is good enough to get the job done. Thanks for the help. Next it would be good if I could determine when I can't find any more, and have it wrap, but I don't think the effort required is worth it Coffee.

Good idea, I'll look into it sometime.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group