Loger

Loger is a small shell script (Unix "sh" shell and compatible), what turns CENTERICQ "history" records to "human readable" logs. Useful (at least for me :-) when I want to re-read an old conversation with somebody. It sends result to standard output, so it can be used with "less" to view/search result or with ">" to save result to a file.

Loger "eats" all the "history" file, right now no way to set him to show "by date" or "lasts 5 days"...

Note: it is very slow...

The script

if [ -e $1 ]; then
 cat $1|while read line; do
 case "$line" in
 `echo "$line"|grep ^[[:cntrl:]]`) echo "";;
 IN) echo -n "Partner ";;
 OUT) echo -n "Me ";;
 AUTH | NOTE | MSG | SMS)
 echo -n "["
 read line
 read line
 echo -n `date -d "1970-01-01 $line sec" +"%Y-%m-%d %T"`
 echo -n "]: ";;
 *) echo "$line";;
 esac
 done
fi
Ransom Smith: 

I find that on my FreeBSD system,

echo -n `date -d "1970-01-01 $line sec" +"%Y-%m-%d %T"`

must be replaced with

echo -n `date -r $line +"%Y-%m-%d %T"`

in order to work properly.

Usage

Nothing special:
loger <path/filename>

Examples

loger history | less
loger ~/.centericq/yMyBoss/history > ~/ToDo.txt

Share this

This entry was posted in Blog, Hacks. Bookmark the permalink.

Leave a Reply