Re: [SLUG] Log CLI session to a file.

From: Eben King (eben1@tampabay.rr.com)
Date: Thu Dec 30 2004 - 18:28:14 EST


On Thu, 30 Dec 2004, Chuck Hast wrote:

> On Thu, 30 Dec 2004 16:30:00 -0500, Levi Bard
> <taktaktaktaktaktaktaktaktaktak@gmail.com> wrote:
> > On Thu, 30 Dec 2004 12:51:32 -0800, Chuck Hast <wchast@gmail.com> wrote:
> > > I was trying to find the way to pipe a CLI session to a file yet still be able
> > > to see and type in the session, I just want to log all of the activity on the
> > > CLI session or console to a file. I had it somewhere and seem to have lost
> > > the location of the info.
> >
> > You can use tee to duplicate/split a stream (like a t-junction for a
> > pipe) - I dunno how well it would work with something like a curses
> > app...
> >
>
> This is just to start up a CLI app, there should be nothing, but I am getting
> some errors so I want to log them while I am issuing commands and
> trying to start the app. It is sending more error messages than I have screen
> I am not running X, just a console.
>
> I was trying to find the format for doing the tee with both file and console
> getting I/O.

Well, I tried this and it worked sorta:

pine | tee logfile

but logfile gets all the ANSI color codes (so does the screen), so it (the
file) is really hard to read. Piping it through

tr -dc '[:print:]'

removes the escape characters, but not the rest of the sequence. I saw
something a while back that would remove extra junk but leave tabs etc. I
guess it's kind of a judgement call as to what stays and what goes, sorta
like "what's a weed" when gardening.

(some experimentation later)

However,

TERM=vt100 pine -f linux | tee logfile

then

fold -s -w 80 < logfile | sed 's/^[\[[0-9;]*[mrHJKO]//g' | pr -Tc | less -S

does seem to catch everything with no ANSI interference, but it looks really
bad. Me, I'd use copy & paste from an xterm or similar.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar

Hi! I'm a .sig virus! Copy me to your .sig!

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:25:34 EDT