sometimes i’m dealing with large manticore logs where queries include line breaks.
this helps me to get them into form that grep can work with:
cat query.log |tr '\n' ' '|tr '\r' ' ' |sed 's/\/*/\n\/*/g' |sed 's/[[:space:]]+/ /g' |less
for mysql’s slow query log:
cat mysql-slow.log|awk '/^#|^SET|^Time|^User|^Host|^Query_time|^Use/ {if (sql) print sql; print; sql=""; next} {sql = sql ? sql " " $0 : $0} END {if (sql) print sql}' |tr -d '\r'|tr -s ' ' > mysql-slow-single.log