How to remove "~" in those files

You should seriously consider reading http://whytheluckystiff.net/ruby/pickaxe/

And this question is suited for ruby-lang