Skip to content

Instantly share code, notes, and snippets.

@jcmuller
Created December 17, 2013 16:23
Show Gist options
  • Save jcmuller/8007713 to your computer and use it in GitHub Desktop.
Save jcmuller/8007713 to your computer and use it in GitHub Desktop.
for i in `find . \( -name '*html*' -or -name '*.rb' -or -name '*css' -or -name '*sass' -or \
-name '*.feature' \) -type f \! \( -path '*.git*' -or -path '*tmp*' -or -path '*solr*' -or \
-path '*/log/*' -or -path '*/public/*' -or -path '*/vendor/*' \)`
do
echo "Processing ${i}..."
cat -s "$i" > "$i.work"; mv "$i.work" "$i" # remove mulptiple lines empty within file
awk '/^$/ {nlstack=nlstack "\n";next;} {printf "%s",nlstack; nlstack=""; print;}' "$i" > "$i.work"; mv "$i.work" $i # only one new line character at EOF
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment