Skip to content

Perl Script to Count Lines of Code of Perl, PHP and HTML Files. This script counts all supported files in a directory and each subdirectory.

License

Notifications You must be signed in to change notification settings

echo2echo/Count-Lines-of-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Count-Lines-of-Code

Perl Script to Count Lines of Code of Perl, PHP and HTML Files

Place script in directory with files to count

Grant permission to run script:

$ sudo chmod 755 count_lines_of_code.pl

For example, to count lines of all the Perl files in a directory and each subdirectory

$ ./count_lines_of_code.pl --type=Perl

For example, to count lines of all PHP files in a directory and each subdirectory

$ ./count_lines_of_code.pl --type=PHP

There is now support for counting .shtml and .htm files along with vanilla .html files. Use flag --type=HTML for each variation

For example, to count lines of all HTML files in a directory and each subdirectory

$ ./count_lines_of_code.pl --type=HTML

To count lines of code of a webpage, run something like the following in the same directory as the count_lines_of_code.pl script

$ wget -cO - http://website.net > filename.html

Then run the script...

$ ./count_lines_of_code.pl --type=HTML

To get a count for a single HTML file try a variation of the following...

$ ./count_lines_of_code.pl --type=HTML | grep -A 4 "filename.html"

Or for a single Perl file...

$ ./count_lines_of_code.pl --type=Perl | grep -A 5 "filename.pl"

Files to be counted require read permission. If there is a permission error you could try running script with sudo, something like the following...

$ sudo ./count_lines_of_code.pl --type=Perl | grep -A 5 "filename.pl"

About

Perl Script to Count Lines of Code of Perl, PHP and HTML Files. This script counts all supported files in a directory and each subdirectory.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages