9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Javaのステップ数を数える

Posted at

Javaに限らず,C系の言語だと似たようなものかも.

コメントや空行などを除いて行を数える:

$ find . -name '*.java' -type f | xargs grep -Ev '^[[:space:]]*((/?\*.*/?)|(//.*))$' | wc -l

ブレイスやセミコロンだけの行を除くならこんな感じか:

$ find . -name '*.java' -type f | xargs grep -Ev '^[[:space:]]*((/?\*.*/?)|(//.*)|[{};][[:space:]]*)$' | wc -l
9
8
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
9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?