A naive version which will sort the keys in a s3 folder. It would not work if the keys contain spaces.
Here is a usage example
aws s3 ls BUCKETNAME/signals/wifi/ | ~/bin/aws-s3-sort.rb
#!/usr/bin/ruby
content = ARGF.read
lines = content.split("\n")
key_size = {}
lines.each do |line|
cells = line.split(' ')
key_size[cells[2]] = cells[3]
end; ''
sorted = key_size.sort_by { |k, v| k.to_i }.to_h
sorted.each do |key, value|
puts "#{key} -> #{value}"
end; ''