Skip to content

Instantly share code, notes, and snippets.

@jeffgeiger
Last active December 22, 2015 13:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jeffgeiger/6477926 to your computer and use it in GitHub Desktop.
Save jeffgeiger/6477926 to your computer and use it in GitHub Desktop.
Colorize columns in bro logs
#!/bin/bash
cat $1 | sed 's/#fields\t\|#types\t/#/g' | awk 'BEGIN {FS="\t"};{for(i=1;i<=NF;i++) printf("\x1b[%sm %s \x1b[0m",(i%7)+31,$i);print ""}'
@dcode
Copy link

dcode commented Sep 9, 2014

cat $1 | sed 's/#fields\t|#types\t//g' | grep -v "^#" | awk 'BEGIN {FS="\t"; OFS=FS};{for(i=1;i<=NF;i++) printf("\x1b[%sm%s\x1b[0m%s",(i%7)+31,$i,OFS); print ""}'

@itsreallynick
Copy link

sed 's/^#[a-z]*s[^a-z]//' | awk 'BEGIN {FS="\t"};{for(i=1;i<=NF;i++) printf("\x1b[%sm %s \x1b[0m",(i%7)+31,$i);print ""}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment