Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] bash_completion: improvement, fixes and tests [was: Re: subversion and programmable completion]



# julianfoad@xxxxxxxxxxxxxxx / 2003-07-24 02:29:41 +0100:
> Philip Martin wrote:
> >Julian Foad <julianfoad@xxxxxxxxxxxxxxx> writes:
> >
> >>   # Find the relevant lines;
> >>   # remove brackets and commas; put each word on its own line.
> >>   sed -n -e '1,/^Available subcommands:$/d;/^$/q' \
> >>          -e 's/[ )]//g;s/[(,]/\n/g;p' |
> >
> >$ sed -V | head -1
> >GNU sed version 3.02
> >$ echo 'x(y' | sed 's/[(,]/\n/g'
> >xny
> 
> Oh dear.  I don't know why you get that.

    because that's what it's supposed to do. read the sed description in
    SUSv3. (I'd quote the two paragraphs here but I fear breaking the
    ToS...) basically:

    * \n is not a valid replacement metacharacter
    * behavior of \X where X is not one of &, <digit>, <delimiter> or
      <newline> is undefined
    * if you want to embed a newline in the replacement, do it this way:

    sed 's/BRE/first part\
    second part/'

    Julian, looks like your sed is broken.
    I know I'm coming awfully late, but wanted to make this clear.

-- 
The From: header's been munged to get rid of unwanted cc's.
My real address: neuhauser@xxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author