Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 24 lines (20 sloc) 0.518 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/ruby

# Given a file of Dewey call numbers,
# it outputs a file ready to be used
# to make a hundreds-by-tens levelplot
# dentogram, by printing the hundreds and
# tens numbers separated by a space
#
# 614.59939 -> 6 1
# 598.29729 -> 5 9
# 767 -> 7 6

file = ARGV[0]

File.read(file).each do |line|
  next unless line.length > 2
  line.chomp!
  hundreds = line.slice(0,1)
  tens = line.slice(1,1)
  next unless (/\d/).match(hundreds)
  next unless (/\d/).match(tens)
  puts "#{hundreds} #{tens}"
end
Something went wrong with that request. Please try again.