in reply to Print while filtering ouput...

perl -ne"print if !m{/}" infile > outfile

Update: Oops! Forgot to negate. Fixed.

Replies are listed 'Best First'.
Re^2: Print while filtering ouput...
by Anonymous Monk on Feb 26, 2009 at 03:23 UTC
    Thanks for the rapid response to my question but I couldn't determine how to apply your suggestion to my code.
    How would you apply your suggested solution to the line
    print OUTFILE "$lines";
    I tried Lawliet's suggestion as follows and it worked great.
    print OUTFILE "$lines" unless $lines =~ /\//;
    Your suggested syntax exceeded my tiny brain's ability to compile.
    Warmest regards,
    Generator

      I couldn't determine how to apply your suggestion to my code.

      It's a replacement for your code. Replace infile and outfile with the name of your files.

      -ne"print if !m{/}" expands to

      while (<>) { print if !m{/} }

      And that's all the code you need to do what you asked.