Script to delete a line from many files

Alan Dayley plug-discuss@lists.plug.phoenix.az.us
Thu, 24 Apr 2003 17:01:58 -0700


Kevin Buettner wrote:
> On Apr 24,  4:37pm, Alan Dayley wrote:
> 
> 
>>Attention script wizards:  I have a utterly simple request.
>>
>>I need a script to do the following:
>>- Command line input
>>-- Regular expression to find
>>-- Filenames to process
>>- Delete line in file that contains matching regular expression
>>
>>That's it.
>>
>>I have yet to take the time to learn sed, awk or other such tools and I 
>>just want a script now.  (Instant gratification thing.)
> 
> 
> You don't even need a script.  Just do:
> 
> perl -i -ne 'print unless /your regex here/' file1 file2 ...
> 
> If you want to create a backup file of each file modified, just do
> (instead):
> 
> perl -i.bak -ne 'print unless /your regex here/' file1 file2 ...
> 
> Kevin

Thank you Kevin!  Just one more tweak would be cool.  I have many files 
to process so what would it take to make the "file1 file2 ..." input 
into a regular expresion too, or to automatically get the file list from 
the ls command or something?

Alan