Last active
November 3, 2018 09:51
-
-
Save hexium310/1e1b76a6e2f0d50a8e8d5dda8cbc7e51 to your computer and use it in GitHub Desktop.
Display the files (*.php or *.js) which end with the duplicate new lines under the current directory.
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
array=$(find . -type d \( -name 'node_modules' -o -name 'vendor' \) -prune -o -type f \( -name '*.js' -o -name '*.php' \) -print) | |
for a in $array; do | |
start=$(expr $(wc -c < $a) - 2) | |
[[ $start -lt 0 ]] && continue | |
new_line=$(hexdump -s $start $a | cut -c 9-13) | |
[[ $new_line = '0a 0a' ]] && echo "$a: $new_line" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment