Skip to content

Instantly share code, notes, and snippets.

@bosmievoll
Created January 25, 2012 08:53
Show Gist options
  • Save bosmievoll/1675499 to your computer and use it in GitHub Desktop.
Save bosmievoll/1675499 to your computer and use it in GitHub Desktop.
JUL log sanitizer
!/bin/bash
# Takes double line java.util.logging output and creates single line.
gawk -W re-interval \
'/[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{3} (AM|PM)/ \
{ORS=" "; print gensub(/^([^:]+:)(.*)/, "\\2 \\1", "g")}
!/[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{3} (AM|PM)/ \
{ORS=RS; print}' \
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment