Skip to content

Instantly share code, notes, and snippets.

@kizashi1122
Created May 29, 2015 11:01
Show Gist options
  • Save kizashi1122/805e4a7f88829f684576 to your computer and use it in GitHub Desktop.
Save kizashi1122/805e4a7f88829f684576 to your computer and use it in GitHub Desktop.
count CR and LF
#!/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