On Jan 12, 6:37 ¨Βν¬ Άιτσνε²±³Ά Όιτσνε®®®ΐθοτναιμ®γονΎ χςοτεΊ > I have a file of code that has "!"-delimited lines and other non !-delimited > lines. I want to remove all the "!"-delimited lines > > !some stuff that i do not want! > > lots of other stuff that i want > lots of other stuff that i want > > !some stuff that i do not want! > > lots of other stuff that i want > lots of other stuff that i want > > What would be a simple ruby script to use regex and remove all the > !....! IO.readlines( 'file.txt' ).delete_if{ |line| line =~ /^!.*!$/ } #=> returns an array; you may want to .join it with the newline seperator.