Skip to content

Instantly share code, notes, and snippets.

@papachristoumarios
Last active November 13, 2018 11:01
Show Gist options
  • Save papachristoumarios/f184d95f0d7ef3f7e5888e2478be4085 to your computer and use it in GitHub Desktop.
Save papachristoumarios/f184d95f0d7ef3f7e5888e2478be4085 to your computer and use it in GitHub Desktop.
Common Identifiers in Souce Code Files
#!/bin/bash
# Find common identifiers in .c and .h files
# Author: Marios Papachristou
# Usage: ./common_identifiers.sh 1000 >most_common.txt
find . -type f -name "*.[c\|h]" |
xargs cat |
tr -c 'A-Za-z' \\n |
sort |
uniq -c |
sort -rn |
head -$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment