Hello Chris,

On Thu, Feb 11, 2010 at 09:32:11AM -0800, Chris Weyl wrote:
> Or, appropriately enough, a Perl one-liner :)
> 
> perl -e 'while (<>) { chomp; s/\s+$//; split / >= /; $v{$_[0]} =
> $v{$_[0]} > $_[1] ? $v{$_[0]} : $_[1] } do { print $v{$_} ? "$_ >=
> $v{$_}\n" : "$_\n" } for sort keys %v'
> 
> (caveat: first shot, only one cup of coffee.  Possibly undercaffinated)

I think the problem with the above is that is relies on ">="; there
can be different relations.  Actually, the problem that triggered
this idea was redundant provides, with relation "=".

I invented an awk one-liner:

awk 'prev != "" && $1 != prev {print prev}
{sub(/[[:blank:]]+$/,"");prev=$0} END{print prev}'

But I have run off energy right now, so I have not tested deploying
it to the perl_default_filter.

I believe that keeping sed & awk in the filtering macros is good for
future inclusion into rpm or redhat-rpm-config, because it might be a
good idea to have the minimal build root without perl, so that mock
runs faster.

Have a nice day,
        Stepan
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-de...@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/perl-devel

Reply via email to