From 0ee0616c1a6272b7c351b43fe20f221cd1c53ebd Mon Sep 17 00:00:00 2001 From: Weibin Yao Date: Thu, 23 Feb 2012 10:14:59 +0000 Subject: [PATCH] add chomp script --- util/chomp.rb | 5 +++++ util/chomp.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 util/chomp.rb create mode 100755 util/chomp.sh diff --git a/util/chomp.rb b/util/chomp.rb new file mode 100644 index 0000000..dea1060 --- /dev/null +++ b/util/chomp.rb @@ -0,0 +1,5 @@ +STDIN.each do |line| + next unless line + res = line.gsub(/\s+$/, "") + puts "#{res}" +end diff --git a/util/chomp.sh b/util/chomp.sh new file mode 100755 index 0000000..1f2dd03 --- /dev/null +++ b/util/chomp.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +for file in * +do + if [ -d "$file" ] + then + continue + fi + + ruby util/chomp.rb < $file > /tmp/tt + mv /tmp/tt $file +done + +rm -f /tmp/tt