On Tue 09 Jul 2024, Страхиња Радић wrote:
>
> sourcesize()
> {
> find . -name '*.[ch]' -exec wc -l {} \; |
> awk '{
> size = $1
> f = $2
> sum += size
> printf "%10d %s\n", size, f
> }
> END{
> printf "%10d total\n", sum
> }'
> }
>
> gives
>
> 550599 total
>
> when run in the root of Vim's repository. Aside from being a rough
> estimate (it doesn't distinguish comment lines from real code), that
> includes X11 code and various other features which could be opted out.
Always used:
wc -l $(find vim90 -name '*.[ch]')
Which gives roughly the same *rough* estimate: 516,321.
I take it you have that function for cases where the number of files is very
large and would not fit the buffer for your shell? You can also group your
wc(1) calls by using + as your terminator instead of \;.