Timeline for sed: deleting the last line (of the input) stops my script
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 28, 2023 at 5:56 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 | added 511 characters in body |
| Aug 28, 2023 at 5:43 | history | edited | aviro | CC BY-SA 4.0 | added 556 characters in body |
| Aug 28, 2023 at 3:49 | comment | added | seshoumara | @minorChaos Command a actually appends text to the standard output. If you wanted to append to pattern space you would do s/$/text/. Furthermore, d deletes pattern space but also stops the execution of the rest of the script commands since it immediately starts a new cycle, by reading in the next input line. Hope this helps. | |
| Aug 28, 2023 at 1:16 | comment | added | minorChaos | Why this works? I have tested it and it does. However I am reading the commands as "append the text [to the pattern space]" and "delete pattern space ..." which would together mean that the appended text would become deleted, too. | |
| Aug 28, 2023 at 0:11 | history | answered | aviro | CC BY-SA 4.0 |