Timeline for How can I escape special characters in a sed "sub-command"?
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 13, 2017 at 12:36 | history | edited | CommunityBot | replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/ | |
| Feb 3, 2017 at 3:39 | comment | added | Wildcard | @StéphaneChazelas, would there be any issue with using something like printf '1,2ya\nn\n0p\nx\n' | ex source.xml sample.xml? As far as I can tell, ex will always reliably exit in this case, having either successfully performed the expected edit or having done nothing. | |
| Mar 11, 2016 at 16:05 | history | edited | Wildcard | CC BY-SA 3.0 | Add link to POSIX specs |
| Mar 11, 2016 at 16:04 | comment | added | Wildcard | That's true. In which case the thing to do is type q! and press enter, then try the command again, removing the -s option, to see what error you're getting. | |
| Mar 11, 2016 at 16:02 | comment | added | Stéphane Chazelas | A common problem with ex in scripts is that if there's a problem, like the first file has fewer than 2 lines, or one of the file is not readable or writable, ex will end up hanging waiting for user input. The error handling with ed or ex is generally tricky. | |
| Mar 11, 2016 at 15:51 | comment | added | jktravis | Cool! Thanks! I'll look at using ex for these kinds of things in the future! | |
| Mar 11, 2016 at 15:50 | vote | accept | jktravis | ||
| Mar 11, 2016 at 15:49 | history | edited | Wildcard | CC BY-SA 3.0 | added 307 characters in body |
| Mar 11, 2016 at 15:40 | history | answered | Wildcard | CC BY-SA 3.0 |