#!/bin/sh
cat /var/log/manticore/query.log | sed '/ (0,[0-9][0-9]\+)\] \[/!d; /_index\] *$/d; s/\[... \(...\)  \?\([0-9]\+\) [0-9.:]\+ \([0-9]\+\)\].*\] \[\([a-z]\+\)\(_main\)\?_index[^]]*\] \?\(.*\)$/\2 \1 \3,\4,\6/'

#!/bin/sh
cat /var/log/manticore/query.log | LANG=C sed '/ (0,[0-9][0-9]\+)\] \[/!d; /_index\] *$/d; s/\[... \(...\)  \?\([0-9]\+\) [0-9.:]\+ \([0-9]\+\)\].*\] \[\([a-z]\+\)\(_main\)\?_index[^]]*\] \?\(.*\)$/\2 \1 \3,\4,\6/'

Fix sed parsing on invalid UTF-8 byte sequence
Fix sed parsing on invalid UTF-8 byte sequence

sed wouldn’t convert lines that contains invalid UTF-8
byte sequences. Some do, problably when browsers send
search queries in unexpected encondings.
