Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi PerlMonks, Could anyone tell me how to remove a lines containing Text "sample" in a set of files in a directory.
  • Comment on remove a line from a set of file in a directory

Replies are listed 'Best First'.
Re: remove a line from a set of file in a directory
by Transient (Hermit) on Jul 22, 2005 at 16:06 UTC
    perl -ni -e 'print unless /sample/' *.*

    This WILL modify all files in the directory. Use with caution.
      To OP: do perldoc perlrun for the explaination of the -i switch including how to have it make backup copies for you.
      Also, you may want * instead of *.* for _all_ (including extension-less ones) (though note that on linux that won't get hidden files)