Skip to content

Instantly share code, notes, and snippets.

@enedil
Created February 25, 2015 22:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/usr/bi/env ruby
input_file = ARGV[0]
output_file = ARGV[1]
strings = []
File.readlines(input_file).each do |line|
strings << [line.length, line]
end
strings.sort_by! { |array| array[0] }
strings.each do |s|
open(output_file, 'a') { |f|
f.puts s[1]
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment