Mailinglist Archive: opensuse (818 mails)

< Previous Next >
Re: [opensuse] Java script assistance (slightly OT)
David Haller wrote:
Depends on what meaning you want the +() to have. [snip] Mind you:
that "escaping for sed" is completely seperated from "escaping in the
shell". E.g.:

sed s/\\\(.\\\)/X\\\1/g

== sed "s/\(.\)/X\1/g" ### remember what you need to escape from
### the shell inside the "" though! == sed 's/\(.\)/X\1/g'

!= sed 's/(.)/X\1/g' => ERROR: "invalid reference \1 on `s'
command's RHS" (there is no "grouping" on the LHS).

With '\+' it's analoguous (and \+ is not portable, IIRC, but
available in GNU sed for at least 10 years, I think). Again: 'man 7
regex' should clear up most of your misunderstandings. But feel free
to ask for further clarifications / explanations (esp. where shell
quoting/escaping is involved, that can get quite confusing ;)

[snip] If you don't, you might get confused by "what's escaped from
the shell and what for sed/grep ...

This reminds me of why I like Perl. Sure its ugly and complicated but at
least its just one sort of ugly for everything!
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups