On Sun, Apr 17, 2005 at 01:26:27PM -0700, Linus Torvalds wrote:
>
>
> On Sun, 17 Apr 2005, Russell King wrote:
> >
> > It's trivial to change - it's either sort -n or sort -nr !
>
> Yes.
>
> Btw, it might make sense to do the "grep" before the sort, since the sort
> doesn't scale as nicely with lots of output. On the other hand, then the
> grep pattern needs to be a bit more complex (so that it doesn't pick up on
> things that have _parents_ with ":1"). I think the rev-tree output is
> obvious enough that it's pretty trivial to grep for..
sed works as well - in fact, we can use it to both select lines based
upon the :1 _and_ cut out the bulk of the stuff we're not interested in.
So:
rev-tree $to $prev | \
sort -nr | cut -d' ' -f2 | grep :1 | cut -d: -f1
becomes:
rev-tree $to $prev | \
sed -n 's,\([[:digit:]]\+\)[[:space:]]\+\([[:xdigit:]]\+\):1.*,\1 \2,p' | \
sort -nr | cut -d' ' -f2
(appologies to those who don't like regexps 8))
One thing to note about that sed expression though - using \+ is a GNU
extension - do we care about that? The portable way is to use \{1,\}
but that'd clutter it some more.
--
Russell King
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html