I'm studying the ed text editor.
To exit from input mode, a user should enter a line a single period (.
).
Let's say I want to enter the period as text.
I thought of a workaround: first, I insert something like ..
. Then, I replace ..
with .
.
But my approach is little unwieldy. Is there a better way to do this?
A non-quoted backslash ' \ ' is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline .
Three Ways to Escape Spaces on WindowsBy enclosing the path (or parts of it) in double quotation marks ( ” ). By adding a caret character ( ^ ) before each space. (This only works in Command Prompt/CMD, and it doesn't seem to work with every command.) By adding a grave accent character ( ` ) before each space.
Reading through the C source for GNU ed(1)
, there is no escape character. On the occasions that I've wanted to do this, I tend to add a blank line and then use a quick substitution:
a↵
↵
.↵
s/^/.↵
or you can add a character then delete it (which, if you're playing ed(1)
golf), is one character more than above)
a↵
x↵
.↵
s/./.↵
I didn't found magic escape sequence.
It seems it doesn't exist.
But this link offers 2 solutions. First I described in my question. Second one is closer to a solution with escape.
r ! echo .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With