Skip to content

Instantly share code, notes, and snippets.

@brightredchilli
Created June 11, 2018 21:58
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 brightredchilli/257cc71861b30172a117fbd9130183b2 to your computer and use it in GitHub Desktop.
Save brightredchilli/257cc71861b30172a117fbd9130183b2 to your computer and use it in GitHub Desktop.
Count lines in files matching a certain criteria
"grep all filenames containing Interactor.swift, quote the output so that we can pass to xargs
"then sort by line count, then use awk again to remove some unnecessary columns
find Code | grep Interactor.swift | awk '{printf("\"%s\"\n", $0);}' | xargs wc | sort --reverse -k 1 | awk '{$2=$3=""}1'
@cecibelrojas
Copy link

"grep all filenames containing Interactor.swift, quote the output so that we can pass to xargs
"then sort by line count, then use awk again to remove some unnecessary columns

find Code | grep Interactor.swift | awk '{printf(""%s"\n", $0);}' | xargs wc | sort --reverse -k 1 | awk '{$2=$3=""}1'

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