[GRASS-dev] Re: [GRASS GIS] #1164: newlines in sed scripts not
portable for wingrass
GRASS GIS
trac at osgeo.org
Mon Sep 20 23:41:07 EDT 2010
#1164: newlines in sed scripts not portable for wingrass
---------------------------+------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
Type: defect | Status: new
Priority: minor | Milestone: 6.4.1
Component: Default | Version: svn-develbranch6
Keywords: wingrass, sed | Platform: MSWindows XP
Cpu: x86-64 |
---------------------------+------------------------------------------------
Comment(by hamish):
Replying to [comment:1 glynn]:
> If you want to insert a literal newline, you're supposed to
> use backslash-newline, i.e.:
> {{{
> echo "abc" | sed -e 's|b|\
> |'
> }}}
Only gotcha is that the sed expression needs 'single' quotes not "double"
ones to get that to work:
{{{
$ echo "abc" | sed -e 's|b|\
|'
a
c
$ echo "abc" | sed -e "s|b|\
|"
ac
}}}
but with that it's good. thanks.
committed to 6.5svn r.in.wms with r43549, a couple of left-hand-side s///
'\n's remain, will wait and see how those behave (since sed is line by
line I'm kinda surprised those would work at all even when right-hand-side
replacement was functional.. shrug).
I guess the right hand side was working before because it was using
"double" quotes and the shell was doing the newline replacement, not sed.
Sort of like "echo -e" without asking for it..
Hamish
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1164#comment:2>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list