Skip to content

Instantly share code, notes, and snippets.

@enedil
Created February 25, 2015 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enedil/56688b12bbb5613277e5 to your computer and use it in GitHub Desktop.
Save enedil/56688b12bbb5613277e5 to your computer and use it in GitHub Desktop.
#!/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