LineCounter (lc) is a command-line utility for counting lines in files.
Download the latest release, and ensure lc.exe is somewhere in %PATH%
Download the latest release, and ensure lc is somewhere in $PATH or create a symbolic link in /usr/bin
To count lines in all files in the current directory, just run the command!
$ lcTo count lines in all files in the current directory and subdirectories, add the recurse flag (or r for short)
$ lc --recurse
# or
$ lc -rYou can also optionally specify a regular expression as a file matching pattern. For example, recursively counting all the lines in every .cs file can be done like so:
$ lc --recurse --pattern "\.cs$"
# or
$ lc -rp "\.cs$"You can optionally specify a path to search, instead of the current directory
$ lc ./srcBy default, this tool does not count every line. Lines that are empty or contain only whitespace are ignored. You can bypass this with the --include-whitespace or -w flag
$ lc ./src --include-whitespace --recurse --pattern "\.cs$"
# or
$ lc ./src -wrp "\.cs$"To ignore directories in the count, specify a semicolon-separated list of folder names to be ignored by using the --ignore or -i flag
$ lc ./src --include-whitespace --recurse --pattern "\.cs$" --ignore "Resources;Properties"
# or
$ lc ./src -wrp "\.cs$" -i "Resources;Properties"To ignore lines that contain only specific characters (for example, ignoring lines which contain only { or }), use the --ignore-chars or -c flag
$ lc ./src --include-whitespace --recurse --pattern "\.cs$" --ignore "Resources;Properties" --ignore-chars "{}"
# or
$ lc ./src -wrp "\.cs$" -i "Resources;Properties" -c "{}"-w, --include-whitespace (Default: false) Include empty lines or lines containing only whitespace in the final
count.
-i, --ignore (Default: ) A list of directories to ignore separated by a ; character.
-c, --ignore-chars (Default: ) A list of characters to ignore.
-p, --pattern (Default: ^.+$) Regular expression for matching.
-r, --recurse (Default: false) Include recursive file searching.
-v, --verbose (Default: false) Output detailed information.
--help Display the help screen.
--version Display version information.
This tool is provided as-is and by running it you accept any and all liability should the tool behave unexpectedly.