Skip to content

Instantly share code, notes, and snippets.

@freshyill
Last active April 25, 2018 15:40
Show Gist options
  • Select an option

  • Save freshyill/ec935fdcd8524e2b1f249035dbae57d5 to your computer and use it in GitHub Desktop.

Select an option

Save freshyill/ec935fdcd8524e2b1f249035dbae57d5 to your computer and use it in GitHub Desktop.
Count lines in a directory of files
COUNTER=0;
for files in *;
do
if test -f "$files"; then
LINES=`wc -l $files | awk '{print $1}'`
fi
COUNTER=`expr $COUNTER + $LINES`;
done
echo $COUNTER;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment