Skip to content

Instantly share code, notes, and snippets.

@glynhudson
Last active March 2, 2017 11:53
Show Gist options
  • Save glynhudson/2fba72e5eb894ac2d4918b3ed2bcb957 to your computer and use it in GitHub Desktop.
Save glynhudson/2fba72e5eb894ac2d4918b3ed2bcb957 to your computer and use it in GitHub Desktop.
Remove x number of lines from the bottom of all html files in a directory (default 1 line removed)
for file in ./*.html; do
[ -f "$file" ] &&
length=$(tail -n 1 "$file" | wc -c) &&
[ "$length" -gt 0 ] &&
truncate -s "-$length" "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment