find_stray_empty_lines 554 B

12345678910111213141516171819
  1. #!/bin/sh
  2. grep -n -B1 -r $'^\t*}$' . | grep -A1 '.[ch]-[0-9]*-$'
  3. grep -n -A1 -r $'^\t*{$' . | grep -B1 '.[ch]-[0-9]*-$'
  4. # or (less surefire ones):
  5. grep -n -B1 -r $'^\t*}' . | grep -A1 '.[ch]-[0-9]*-$'
  6. grep -n -A1 -r $'^\t*{' . | grep -B1 '.[ch]-[0-9]*-$'
  7. # find trailing empty lines
  8. find -type f | while read file; do
  9. test x"$file" = x"" && continue
  10. tail -n1 $file | while read lastline
  11. do
  12. #echo "|$file|$lastline"
  13. if test x"$lastline" = x""; then
  14. echo "$file"
  15. fi
  16. done
  17. done