perl -pe '$skip=0 if /^end$/; next if $skip; $skip=1 if /^begin$/' dat +a.txt
Or a little more drawn out:
#!/usr/bin/perl use warnings; use strict; my $skip=0; while(<DATA>) { $skip=0 if /^end$; print unless $skip; $skip=1 if /^begin$/; } __DATA__ a begin 1 <----- delete a <----- delete 2 <----- delete end c begin c end a begin 1
In reply to Re: how to cut context between first "begin" and "end"?
by spazm
in thread how to cut context between first "begin" and "end"?
by cxfcxf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |