public
anonymous / filter.rb
Created

answer to a question on ruby-talk

  • Download Gist
filter.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12
#regexes for find/replace
add_tabs = /^(term1)/
remove_tab = /\t(\tterm2)/
clear_stuff = /.*hat\.goat\sthis thing\sthat thing\sstuff\scheese/m
 
 
#read file and replace
puts "Paste in your input:"
while (line = gets)
next if $. == 1 .. line =~ clear_stuff
print line.gsub(add_tabs, "\t\t\\1").gsub(remove_tab, "\\1")
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.