New answers tagged escape-characters
1
vote
Accepted
How to convert all newlines to "\n" in POSIX sh strings
Try awk with:
string='x
y
'
new_string=$(
LC_ALL=C awk -- '
BEGIN {
gsub("\n", "\\n", ARGV[1])
printf "%s", ARGV[1]
}' "$string"
)
In any ...
0
votes
Is it possible to get a character at terminal cursor using ANSI escape codes?
The DECRQCRA escape sequence allows you to query the checksum of a rectangular area.
The checksum is basically the sum of the character codes there. And if you choose a 1×1 rectangular area then... ...
1
vote
How to interpret \e[H\e[2J ANSI escapes sequence from Linux terminal?
\e[H moves the cursor home (top left corner) and \e[2J clears the screen (the regularly viewed part, but not the scrollback).
In many terminal emulators \e[2J simply clears the regularly viewed part ...
1
vote
groff -mandoc creating "ESC[1m" versus overstriking with backspace for bold text
You can abuse script and less to convert the backspace sequences:
script --return --quiet -c "printf '.Dd today\n.Sh NAME\n' | groff -mandoc -Tutf8 | less" /dev/null | od -c
…
0000200 1 ...
2
votes
Accepted
groff -mandoc creating "ESC[1m" versus overstriking with backspace for bold text
Debian Bookworm configures groff 1.22 for the old backspace-overwrite behavior you see there, and documents it in their patched grotty manual page along with how to revert to the newer SGR (\e[1m-like)...
Top 50 recent answers are included
Related Tags
escape-characters × 453bash × 129
terminal × 98
shell × 67
shell-script × 49
quoting × 46
colors × 36
sed × 23
special-characters × 20
echo × 19
zsh × 18
regular-expression × 15
keyboard-shortcuts × 15
prompt × 15
text-processing × 14
command-line × 14
grep × 14
xterm × 14
awk × 12
ansi × 12
linux × 11
scripting × 11
vim × 11
tmux × 11
terminal-emulator × 11