Sunday, June 29, 2008

Adding a line at EOF to a bunch of files at once

Some people use horrible IDE's to write some horrible C/C++ code that will give many nasty warnings in gcc/g++ because of a missing line at the end of file

here is how to add a line to the end of each file


for f in `find . -type f | grep ^.*.c`; do echo -e "\n" >> $f; done


It could be a more sophisticated line of bash, but this will do for the mean time