Mailinglist Archive: opensuse (818 mails)

< Previous Next >
Re: [opensuse] Java script assistance (slightly OT)

On Tue, 20 Sep 2011, Per Jessen wrote:
David Haller wrote:
On Mon, 19 Sep 2011, Per Jessen wrote:
sed -e 's/{/\n{/g' -e s'/}/}\n/g' -e s'/;/;\n/g' <filename

(still not sure if you need to escape the curly brackets).

You don't, as sed uses basic regular expressions (see 'man 7 regex'),
so you need to escape {} to get "special" behaviour (if any).

Okay, but I was more thinking of escaping for the shell - for instance,
when you use () for grouping, they need to be escaped to work. Which I
think(!) is a shell issue, not sed ?

Inside '' you only need to escape ' itself, which doesn't work, as \
has no special meaning either inside of ''.
Workaround: 'foo'"'"'bar' or 'foo'\''bar'

Inside "" you have to IIRC escape !"()`` and $ (the ! only if you've
enabled history substitution (set -H).


"Spies hide guns like squirrels hide acorns." -- Burn Notice, 1x12
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups