Eric Blake wrote:
> According to Jim Meyering on 12/30/2009 1:44 AM:
>>> find modules -name '*-tests' | xargs grep -l License \
>>> | xargs sed -i '/^$/N; /License:/,$ d'
>>
>> Those changes look fine. Thanks.
>>
>> In case there's a next time, you'd want to add a "^"
>> before the "License:" in that sed command:
>
> That wouldn't have worked. The previous N command, to also delete the
> blank line prior to the License line, means that License is no longer at
> the beginning of the pattern stream. But this would do it:
>
> sed -i '/^$/N; /\n*License:$/,$ d'
Indeed. I should have tried it. I don't use sed's "N" enough.
Since these are all tiny files, I'd say just use Perl:
perl -0777 -pi -e 's/\n\n+License:\n.*\n/\n/'