Created
May 29, 2015 11:01
-
-
Save kizashi1122/805e4a7f88829f684576 to your computer and use it in GitHub Desktop.
count CR and LF
This file contains 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/sh | |
file=$1 | |
if [ -f $file ]; then | |
exit | |
fi | |
cr_count=$( grep -c $'\r$' $file ) | |
lf_count=$( grep -c $'\n$' $file ) | |
echo CR: $cr_count | |
echo LF: $lf_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment