1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#!/bin/env ruby
seedoffset = 0
#require 'getopts'
#if getopts( "s:" ) == nil || ARGV.length == 0 || $OPT_h then
# puts "Usage: #{$0} [-s number_of_seeds] input_files"
# exit
#end
#
#if $OPT_s
# seedoffset = $OPT_s.to_i
#end
require 'optparse'
opt = OptionParser.new
OPTS = {}
opt.on('-s VAL') {|v| OPTS[:s] = v}
opt.parse!(ARGV)
seedoffset = OPTS[:s].to_i
files = ARGV
num = seedoffset + 1
for file in files
output = ""
STDERR.puts file
fp = File.open( file, "r" )
while line = fp.gets
if line =~ /^>/ then
output += " " + num.to_s
num += 1
end
end
fp.close
puts output + " # " + file
end
|