Skip to content

Instantly share code, notes, and snippets.

@karsai5
Created August 10, 2013 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karsai5/6198422 to your computer and use it in GitHub Desktop.
Save karsai5/6198422 to your computer and use it in GitHub Desktop.
Removes blank lines from all html, php and css files in a directory. Sometimes when uploading multiple files to a server I find blank lines are inserted between each line of code; this script is to remove those unnecessary lines of whitespace.
#! /bin/bash
for file in $(find . -name '*.html' -o -name '*.php' -o '*.css');
do
sed '/^$/d' $file > tt
mv tt $file
echo "Removing empty lines from file - $file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment