find . -name '*.js' | xargs wc -l
ROCLASI wrote:Just navigate to your workspace and inside this workspace you run the following command:
- Code: Select all
find . -name '*.js' | xargs wc -l
That will give you the amount of lines per .js file and total lines at the end
find . -name '*.js' | xargs wc -l | sort -k1n
find . -name '*.js' | xargs wc -l | awk -F ' ' {'if ($1 != 0) print$0'} | sort -n
ROCLASI wrote:Also if you don't want to see the files with no lines at all you can use the following command:
- Code: Select all
find . -name '*.js' | xargs wc -l | awk -F ' ' {'if ($1 != 0) print$0'} | sort -n
ROCLASI wrote:As for Eclipse metric plugins, the ones I can find are very Java focused. I don't know how well they work with Servoy/Javascript projects/code.
Like this one: http://sourceforge.net/projects/metrics2/
deezzub wrote:I get different counts for the line numbers for the same files. Do you know why?
deezzub wrote:How can I get the sorted line numbers, only for the solution / project folders
find . -name '*.js' | xargs wc -l | awk -F ' ' {'if ($1 != 0) print$0'} | sort -r -t'/' -k2,2 -k1,1 -k3,3
deezzub wrote:How can I get the sorted line numbers, only for the solution / project folders
#!/bin/bash
# Count Lines Of Code (in your Servoy workspace)
# Written by Robert Ivens
# Get passed argument and place it in a variable
Wrkspc=$1
# Check if there was an argument passed
if [ -z "$1" ]
then
# No path given, lets assume the current one
Wrkspc=$(pwd)
fi
# Get all directories in the workspace and loop through them
for Dir in $(find $Wrkspc/* -maxdepth 0 -type d );
do
# Get the foldername only
FolderName=$(basename $Dir)
# Get the line count from all .js files inside this directory
Count=$(( find $Dir -name '*.js' -print0 | xargs -0 cat ) | wc -l)
# Print the Count and Foldername using a format
printf "%10s %-100s\n" $Count $FolderName
done
Users browsing this forum: No registered users and 2 guests