I have the following problem: I want to count migration files per directory.
My structure always looks like this:
/some/path/app1/migrations/0001_hello_world.py /some/path/app2/migrations/0001_foo.py /some/path/app2/migrations/0002_bar.py
What I need is a shell script, in the best case a one-liner to get the following result:
app1: 1 app2: 2
So I get the numbers of files per app directory.
I got as far as getting my list of files:
git diff --color --name-only --diff-filter=A origin/develop my-branch | grep "\/migrations\/[0-9]"
I can count all of those matches with
wc -l but I cannot count per directory.
Unfortunately even with google and stack, I'm stuck.
Any ideas on that topic?