Skip to content

Instantly share code, notes, and snippets.

@dreampuf
Created August 1, 2014 05:59
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 dreampuf/8eba0e27dfb5495acc8c to your computer and use it in GitHub Desktop.
Save dreampuf/8eba0e27dfb5495acc8c to your computer and use it in GitHub Desktop.
Count a folder text file line count group by postfix
#!/bin/bash
find . -type f -print | xargs wc -l | while read count path; do echo ${path##*\.} $count; done | awk '{arr[$1] += $2} END {for (key in arr) printf("%s\t%s\n", key, arr[key])}' | sort
@dreampuf
Copy link
Author

dreampuf commented Aug 1, 2014

result

nc      366
npmignore       5
pack    261147
patch   11660
pbxproj 710
pch     22
pdf     2079
pem     27
plist   229
png     9049
prefs   25
project 147
properties      123
proto   21
ps1     99
pub     1
py      17600
rdf     105
readme  1
sample  497
sh      1329
storyboard      509
svg     1634
thrift  270
total   1726994
ttf     1512
txt     118
woff    260
xcworkspacedata 7
xml     7689
xpi     6
xul     9
yaml    191
yml     587
zip     3295

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