Last active
January 16, 2018 06:34
-
-
Save ipan/599084e90f8a87da03746c28bba0b143 to your computer and use it in GitHub Desktop.
add new lines to json files when there is no newline char #git #ls-files #read
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
# only add when the json file does not have new line | |
git ls-files | grep json | while read f; do tail -n1 $f | read -r _ || echo >> $f; done | |
# https://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file | |
# https://unix.stackexchange.com/questions/192786/what-is-the-meaning-of-read-r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment