Re: grep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Scott McClanahan wrote:

I'd like to skip those lines.  I'd like to skip the line with "bar" and
the following five lines.

In that case, the perl code would be:

#!/usr/bin/perl
$eat = 0;
while (<>) {
    if (m/bar/) {
	$eat = 6;
    }

    if ($eat) {
        --$eat;
    }
    else {
        print;
    }
}


Again, not tested.  Use at your own risk.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux