Jeremy Sowden <jeremy@xxxxxxxxxx> wrote: > This seems to dedup' the payloads correctly: > > perl -nle ' > our @payload; > our $rule; > if (/^# (.+)/) { > if ($rule ne $1) { > print for @payload; > $rule = $1 > } > @payload = () > } > push @payload, $_; > END { print for @payload } > ' tests/py/any/tcpopt.t.payload > tests/py/any/tcpopt.t.payload.tmp > mv tests/py/any/tcpopt.t.payload.tmp tests/py/any/tcpopt.t.payload > > One could use perl's -i switch, but the printing of the final payload > will be to stdout and not in-place. Feel free to send a patch that weeds out all duplicates.