Skip to content

Instantly share code, notes, and snippets.

@dotancohen
Created February 14, 2022 09:43
Show Gist options
  • Save dotancohen/8782216c9e85e43e4c7b0f6f73da1315 to your computer and use it in GitHub Desktop.
Save dotancohen/8782216c9e85e43e4c7b0f6f73da1315 to your computer and use it in GitHub Desktop.
Get most common column names from SQL dump file.
grep -P "^\s+\`" foo.sql | \
sed -E 's/\([0-9]*/(/' | \
awk '{print $1 "\t" $2}' | \
sort | \
uniq -c | \
sort -n -r > db-common-column-names
# 300 MiB SQL file: 0.4 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment