Rather than having the output write the line unless it equals
search_text, I need it to write when it equals search_text. I know that
should be easy, but I can't find the syntax.
On Wed, Feb 2, 2011 at 11:51 AM, Bob Hatch <roberth@monavie.com> wrote:
Rather than having the output write the line unless it equals
search_text, I need it to write when it equals search_text. I know that
should be easy, but I can't find the syntax.
Using if instead of unless is definitely clearer here, but you can also
negate the match operator by replacing =~ with !~ as follows:
outfile.write(line) unless line !~ search_text
Double negatives are usually unnecessarily hard to understand at a
glance though, so use the if statement instead of unless here.
-Jeremy
···
On 2/2/2011 1:08 PM, pat eyler wrote:
On Wed, Feb 2, 2011 at 11:51 AM, Bob Hatch <roberth@monavie.com> wrote:
Rather than having the output write the line unless it equals
search_text, I need it to write when it equals search_text. I know that
should be easy, but I can't find the syntax.