Created
September 11, 2017 18:18
-
-
Save eduardoaugustojulio/189533e85a8ac282d1ac63b9ed98ee3c to your computer and use it in GitHub Desktop.
simple bash file line counter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TOTAL=0 | |
for i in "$@" | |
do | |
LINE_COUNT=`wc -l < "$i"` | |
echo "file $i have total $LINE_COUNT lines" | |
TOTAL=$(($TOTAL + $LINE_COUNT)) | |
done | |
echo "all files together have $TOTAL lines" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to use that script do:
chmod +x line_counter.sh
./line_counter path_that_have_files/*
them they will say how many lines all files have.