On Tue, Nov 06, 2018 at 09:50:09AM +0100, Damien Thiriet wrote:
> Hello misc@,
>
>
> This is OpenBSD 6.4 stable. Since 6.3, I have troubles with
> newline insersion in sed replacement pattern. I remember
> doing it in previous versions. I bet I forgot the good way
> to do it, but I am not sure.
> When I do
>
> echo \\page > foo
> sed "s/\\page/\
> \\stopDiapo/" foo
> The output is
> une \stopDiapo
>
> I expected
> une
> \stopDiapo
>
> I tried this both in st and xterm.
> echo $LC_CTYPE gives fr_FR.UTF-8
>
> What am I doing wrong?
> Thanks,
>
>
> Damien Thiriet
>
The newline has to be escaped with \\ since the sed expression is within
double quotes.
sed "s/\\page/\\
\\stopDiapo/" foo
Or, use single quotes:
sed 's/\\page/\
\\stopDiapo/' foo
--
Andreas Kusalananda Kähäri,
National Bioinformatics Infrastructure Sweden (NBIS),
Uppsala University, Sweden.