Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mvasilkov
Created November 18, 2013 05:12
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 mvasilkov/7522865 to your computer and use it in GitHub Desktop.
Save mvasilkov/7522865 to your computer and use it in GitHub Desktop.
Remove empty lines at the end of file.
#!/bin/bash
last_non_blank_ln=$(grep -En ^. $1 |tail -n 1 |sed 's/:.*//')
head -n $((last_non_blank_ln + 1)) $1 > _xxx
mv _xxx $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment