On 9 Oct 2002, chad kellerman wrote: > Perl gurus, > > I was wondering if there is a one liner that searches a file for a > string and then removes that line and the following four lines in the > file?
Any particular reason for a one-liner? perl -i~ -pe '((/string/and$ln=$.)..($.-$ln==4))&&undef $_' file Note: In the case where string is 'efgh' and input is like this efgh 1 efgh 2 3 4 5 The above one-liner will delete the first 'efgh' and the 4 lines following it. It will not do an incremental delete. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
