[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: POSIX compliant sed making newline character



On Fri, Aug 21, 2020 at 07:49:07PM +0200, john doe wrote:
> Hello all,
> 
> I'm trying to use the command provided at (1):
> 
> $ sed '/pattern{N;N;a try\d10}' input-file
> sed: -e expression #1, char 0: unmatched `{'

Are you missing a second / character after the pattern?

Why are you obfuscating the command?  Why not SHOW the actual command?

> As I understanded, I should make a newline before the right brace.
> I thought that '\d10' should do it but as shown above it does not.

I have no idea how you came up with that.

If you're doing this from bash, you could use bash's special $'...'
quoting to pass a newline encoded as \n .

Otherwise, put an ACTUAL newline inside the quotes.  You know, by
pressing the Enter key.  That's portable to every sh family shell.


Reply to: