From 732f926025df67f06a99bc07ce4ded4e9ce7de15 Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Sat, 10 Mar 2007 16:47:06 +0000 Subject: [PATCH] The script I use to cleanup files with leading and trailing empty lines --- Scripts/developer_scripts/remove_empty_lines.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 Scripts/developer_scripts/remove_empty_lines.pl diff --git a/Scripts/developer_scripts/remove_empty_lines.pl b/Scripts/developer_scripts/remove_empty_lines.pl new file mode 100755 index 00000000000..74a02fa259e --- /dev/null +++ b/Scripts/developer_scripts/remove_empty_lines.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +# This script-let removes empty lines at the beginning and at the end of the file. +# +# As complement cleanup, one can also remove trailing white spaces at the end of lines: +# perl -pi.bak -e 's/\s+$/\n/' */examples/*/*.cpp + +local($/) = undef; +my $text = <>; + +$text =~ s/\A\n+//mg; +$text =~ s/\n+\Z/\n/mg; + +print "$text";