Skip to content

Instantly share code, notes, and snippets.

@pfaocle
Created July 4, 2013 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfaocle/5928677 to your computer and use it in GitHub Desktop.
Save pfaocle/5928677 to your computer and use it in GitHub Desktop.
Check a SQL dump for the longest line and either outputs the line, or a character count.
# Output longest line to bigfile.txt
cat ./local.sql | awk ' { if ( length > x ) { x = length; y = $0 } }END{ print y }' > bigfile.txt
# Count characters in longest line
cat ./local.sql | awk ' { if ( length > x ) { x = length; y = $0 } }END{ print y }' | wc -m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment