$ echo "HMM\tThis line got a TAB"
HMM\tThis line got a TAB
So it did not work !
To use tabs, new-line, and other formatting characters with UNIX/Linux echo command, specify the -e option:
$ echo -e "HMM\tThis line got a TAB"
HMM This line got a TAB
Similarly:
$ echo -e "A B\nC\nD"
A B
C
D
From ECHO(1) man page:
-e enable interpretation of backslash escapes
If -e is in effect, the following sequences are recognized:
\\ backslash
\a alert (BEL)
\b backspace
\c suppress trailing newline
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
Similar posts:
- Grep and print control characters in a file - UNIX
- Highlight match with color in UNIX grep command
- Print only matched string, not line in grep command
1 comment:
Very good.
Excellent presentation.
Easy way of understanding.
Post a Comment