Created
April 22, 2010 06:48
-
-
Save cth/374899 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Simple utility to remove trailing space in the end of lines | |
# Takes as first argument the file to be processed. | |
lines = [] | |
File.open(ARGV[0]).each do |line| | |
line.reverse =~ /\s*(.*)/ | |
lines << $1.reverse | |
end | |
File.open(ARGV[0],"w") { |file| lines.each { |line| file << line << "\n" } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment