#!/bin/bash
if [ "$1" = "" ]
then
echo "No log file specified"
elif [ -e $1 ]
then
echo processing $1
grep ' : ' $1 | grep -v 'InSim : ' | grep -v 'Fastest lap : ' | grep -v 'PENALTY' | grep -v 'Latin 1' | grep -v 'LFS DEDICATED HOST' | grep -v 'Autocross : 3 checkpoints' | grep -v 'Autocross : 2 checkpoints' | grep -v 'Autocross : 1 checkpoint' > "${1}_chat.log"
rpl --quiet ' : ' ': ' "${1}_chat.log" >/dev/null 2>&1
rpl --quiet '^L' '' "${1}_chat.log" >/dev/null 2>&1
rpl --quiet '^l' '<' "${1}_chat.log" >/dev/null 2>&1
rpl --quiet '^r' '>' "${1}_chat.log" >/dev/null 2>&1
rpl --quiet '^v' '|' "${1}_chat.log" >/dev/null 2>&1
echo "created ${1}_chat.log"
else
echo "File doesn't exist"
fi