[lkml]   [2007]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC PATCH] Add a 'minimal tree install' target

On Thu, Sep 13, 2007 at 09:19:38PM +0200, Sam Ravnborg wrote:
> >
> > sed -n "s/^ALTARCH[[:space:]]:=[[:space:]]\(.*$\)\+/\1/p"
> >
> > (i'm sure there is a better way though)
> Oleg (added to mail) - you are quite confident in sed et al.
> Let us know if there is a simpler way.
> (We want to pick i386 from include/asm-x86_64/Kbuild
> and similar for the architectures that uses ARCHDEF).

That particular one-line `ALTARCH := i386' of course can be matched
simpler, because there's only *one* (as written above) whitespace and no
make's assignment variations, like (?=,=). I wonder, if there can be more
options, than i386 and more occurrences of `ALTARCH' actually :) Also,
make can have lead whitespace on line start, as well as near assignment
sign, if that matters.

So, to match *one* line with *one* `ALTARCH' followed by `i386'

sed -n '/ALTARCH/{/i386/{p ; q}}'

is fine by me. If there are dis-assignments, so to speak, or comments
with i386 this will not work obviously. But it's fast and must work
with variety of make syntax. Check is "for non empty output".

Also, please take a look on man isspace(). It matches much more
characters, than necessary for ordinary syntax whitespace. Using
[:blank:] (i.e. tab and space, with no options) is OK. Last thing: i'm not
sure, what that `+' is. I stick to BRE in sed, as it should be, so just
don't know what it does.

Hope that helps.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-09-13 22:05    [W:0.057 / U:0.244 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site