
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] shell question
>>>>> "TMQ" == Tod McQuillin <devin@example.com> writes:
TMQ> On Fri, 16 Apr 2004, Stephen Lee wrote:
>> I often find myself wanting to remove from piped data lines
>> starting with one regxp and ending with another. e.g.
>>
>> This is line 1
>> Beginning
>> some unneeded data
>> some more unneeded data
>> Finishing
>> Some more lines
>>
>> I want to remove every line between 'Beginning' and 'Finishing'
>> inclusive. Do you know any quick, short command that does it?
TMQ> perl -ne 'print unless /^Beginning$/ .. /^Finishing$/' file
Isn't it amazing how expressive perl is? The ease of writing
unreadable perl scripts is just another proof of it, that's the price
you pay for expressiveness.
--
Viktor
Home |
Main Index |
Thread Index