Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #226373
| From | john doe <johndoe65534@mail.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: POSIX compliant sed making newline character |
| Date | 2020-08-21 20:10 +0200 |
| Message-ID | <AGjEd-7QM-1@gated-at.bofh.it> (permalink) |
| References | <AGjkR-7v0-1@gated-at.bofh.it> <AGjuy-7ye-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 8/21/2020 7:51 PM, Greg Wooledge wrote:
> 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?
>
Yes, I'm missing a '/'.
the command is:
$ sed '/line1/{N;N;a line-to-add}' input-file
>> 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 .
>
So something like the following:
$ sed '/line1/{N;N;a line-to-add$'\n'}' input-file
> Otherwise, put an ACTUAL newline inside the quotes. You know, by
> pressing the Enter key. That's portable to every sh family shell.
>
Actually, I do not know, that is why I'm asking in here! :)
--
John Doe
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
POSIX compliant sed making newline character john doe <johndoe65534@mail.com> - 2020-08-21 19:50 +0200
Re: POSIX compliant sed making newline character Greg Wooledge <wooledg@eeg.ccf.org> - 2020-08-21 20:00 +0200
Re: POSIX compliant sed making newline character john doe <johndoe65534@mail.com> - 2020-08-21 20:10 +0200
Re: POSIX compliant sed making newline character Greg Wooledge <wooledg@eeg.ccf.org> - 2020-08-21 20:40 +0200
Re: POSIX compliant sed making newline character Greg Wooledge <wooledg@eeg.ccf.org> - 2020-08-21 20:40 +0200
Re: POSIX compliant sed making newline character john doe <johndoe65534@mail.com> - 2020-08-21 21:00 +0200
Re: POSIX compliant sed making newline character john doe <johndoe65534@mail.com> - 2020-08-21 21:10 +0200
Re: POSIX compliant sed making newline character Andrei POPESCU <andreimpopescu@gmail.com> - 2020-08-22 18:40 +0200
Re: POSIX compliant sed making newline character john doe <johndoe65534@mail.com> - 2020-08-22 20:50 +0200
Re: POSIX compliant sed making newline character Greg Wooledge <wooledg@eeg.ccf.org> - 2020-08-21 21:10 +0200
csiph-web