Last active
August 29, 2015 14:23
-
-
Save IceDragon200/17999d51f1b34294846e to your computer and use it in GitHub Desktop.
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
result = [] | |
last_line = nil | |
File.open('my_awesome_file_of_doom_and_cookies.txt', 'r') do |file| | |
file.each_line do |line| | |
if line =~ /expected_line/ && (last_line && last_line =~ /expected_previous_line/) | |
result.pop | |
end | |
result << line | |
last_line = line | |
end | |
end | |
File.write('my_awesome_file_of_doom2.txt', result.join) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment