aboutsummaryrefslogtreecommitdiff
path: root/sem4/hpp/eksamnen/placelinenums.rb
blob: 9f43b20bf4056d7f149a431b6ace51490edd93ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
require 'open3'
require 'optparse'

filename = ARGV[0]
outname = ARGV[1]

page = 1
File.open(outname, "w") do |out|
  File.readlines(filename).each do |line|
    if line.start_with? "\xC"
      line[0] = ''
      page += 1
    end

    out.puts "#{page}   #{line}"
  end
end