summaryrefslogtreecommitdiff
path: root/toks-per-line
blob: 8a10cd444f047c93672896de1674b0684e4e5df0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env ruby

uniq = false
uniq = true if ARGV.include? "uniq"
count = true if ARGV.include? "count"

while line = STDIN.gets
  a = line.strip.split
  a.uniq! if uniq
  a.sort!
  if not count
    puts a.join " "
  else
    puts a.size
  end
end