Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 23 lines (20 sloc) 0.518 kb
f6a92ce7 »
2011-08-21 Added scripts
1 #!/usr/bin/ruby
2
3 # Given a file of Dewey call numbers,
4 # it outputs a file ready to be used
5 # to make a hundreds-by-tens levelplot
6 # dentogram, by printing the hundreds and
7 # tens numbers separated by a space
8 #
9 # 614.59939 -> 6 1
10 # 598.29729 -> 5 9
11 # 767 -> 7 6
12
13 file = ARGV[0]
14
15 File.read(file).each do |line|
16 next unless line.length > 2
17 line.chomp!
18 hundreds = line.slice(0,1)
19 tens = line.slice(1,1)
20 next unless (/\d/).match(hundreds)
21 next unless (/\d/).match(tens)
22 puts "#{hundreds} #{tens}"
23 end
Something went wrong with that request. Please try again.