I am writing a script for my research, and I want to get the total number of lines in a source file. I came around cloc and I think I am going to use it in my script.
However, cloc gives result with too many information (unfortunately since I am a new member I cannot upload a photo). It gives number of files, number of lines, number of blank lines, number of comment lines, and other graphical representation stuff.
I am only interested in the number of lines to use it on my calculations. Is there a way to get that number easily (maybe by performing some options in command line (although I went through the available options and didn't find something useful for my case))?
I thought to do regular expression on the result to get the number; however, this is my first time using cloc and there might be a better/professional way of doing it.
Any thought?
Regards, Arwa
I am not sure about CLOC. But it is worth using default shell command. Please have a look at this question.
To get number of lines of code individually
To get total number of lines of code in a directory.
Please note that if you need number of lines from files with specific extension you could use
*.ext.*.rb, if it is ruby.