Created
May 20, 2013 03:01
-
-
Save anonymous/5610197 to your computer and use it in GitHub Desktop.
answer to a question on ruby-talk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment