diff options
author | Julian T <julian@jtle.dk> | 2020-06-09 22:59:59 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-06-09 22:59:59 +0200 |
commit | 0e3cafc48570e4b675ecac11663a5f777b24d339 (patch) | |
tree | e858987f691774f4e2c652ea67ba9ff572d1b304 /sem4/hpp/eksamnen/placelinenums.rb | |
parent | 9300a7c997c986d1c1f1f1ef5f20df44e1ed8f11 (diff) |
Added search scripts
Diffstat (limited to 'sem4/hpp/eksamnen/placelinenums.rb')
-rwxr-xr-x | sem4/hpp/eksamnen/placelinenums.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sem4/hpp/eksamnen/placelinenums.rb b/sem4/hpp/eksamnen/placelinenums.rb new file mode 100755 index 0000000..9f43b20 --- /dev/null +++ b/sem4/hpp/eksamnen/placelinenums.rb @@ -0,0 +1,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 |