Re: Re-done kernel archive - real one?
- From
- Russell King <rmk@arm.linux.org.uk>
- Date
- Apr 17, 2005, 20:42 UTC
- Message-ID
- <20050417214251.G13233@flint.arm.linux.org.uk>
- In-Reply-To
- <Pine.LNX.4.58.0504171324340.7211@ppc970.osdl.org>
On Sun, Apr 17, 2005 at 01:26:27PM -0700, Linus Torvalds wrote:
Show 13 quoted lines
> > > 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