LoginSignup
3
6

More than 5 years have passed since last update.

ソースのステップ数を数える

Posted at

何番煎じかわからないが。

find . -mindepth 2 -maxdepth 3 -name "*.cs" | xargs wc -l
結果例:
    165 ./Xxxxxxxx.Xxxxxxxx.Xxxxxx/Hoge.cs
     29 ./Xxxxxxxx.Xxxxxxxx.Xxxxxx/Fuga.cs
     37 ./Xxxxxxxx.Xxxxxxxx.Xxxxxx/Properties/AssemblyInfo.cs
   1404 ./Xxxxxxxx.Xxxxxxxx.Xxxxxxxxx/Foo.cs
(中略)
    188 ./Xxxxxxxx.Xxxxxxxxxxxxxxxxxx.Xxxxxxx/Baa.cs
  95012 total

単純に find . -name "*.cs" | xargs wc -l とすると、カウント不要なファイル(./aaaa/obj/Debug/hoge_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.cs みたいなの)までカウントしてしまう。
ので、-mindepth-maxdepth を指定して必要っぽい場所だけを検索している。

3
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
6