Site icon Krum Cheshmedjiev

Loger

Loger is a small shell script for Unix sh and compatible shells. It converts CENTERICQ history files into human-readable logs.

It is useful - at least for me - when I want to reread an old conversation. The script writes the result to standard output, so you can pipe it to less for viewing and searching, or redirect it with > to save the output to a file.

Loger processes the entire history file. At the moment, there is no option to filter the output by date or, for example, show only the last five days.

Note: the script is 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:

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"`

for the script to work correctly.

Usage

Nothing special:

loger <path/filename>

Examples

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