count lines of code
How many lines of code a project has, in total and by language.
developmenttext
steps
-
cloc .lines of code, comments and blanks, by language (cloc)
-
tokeithe same, faster (tokei)
-
git ls-files | xargs wc -l | tail -1the lines of every file git tracks
-
find . -name '*.py' -print0 | xargs -0 wc -l | tail -1the lines of every .py file
commands used
cloctokeiwcgit
Each has a page in lore: lore cloc opens it.
fix windows line endings
"bad interpreter: ^M" and odd characters: the file has Windows line endings (CRLF). Find them and change them to Unix ones (LF).
pretty-print json
Show JSON indented and coloured, pick values out of it, from a file or a web request.
read a file line by line
Go through a file's lines in a script, also split into fields, without losing spaces or backslashes.
add up numbers in a file
Sum a column of numbers, from a file or a command's output.