Skip to content

Commit 0ee0616

Browse files
committed
add chomp script
1 parent e2f31f3 commit 0ee0616

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

util/chomp.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
STDIN.each do |line|
2+
next unless line
3+
res = line.gsub(/\s+$/, "")
4+
puts "#{res}"
5+
end

util/chomp.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
for file in *
4+
do
5+
if [ -d "$file" ]
6+
then
7+
continue
8+
fi
9+
10+
ruby util/chomp.rb < $file > /tmp/tt
11+
mv /tmp/tt $file
12+
done
13+
14+
rm -f /tmp/tt

0 commit comments

Comments
 (0)