We have process log with user defined error messages and information echos. I wanted to highlight error messgaes in that log file while writing in it. Is there any option with either echo or any other command which enables making text bold or we can change the font of body text of echo.
there is escape sequence defined which can be used with echo
\033[0m Normal characters
\033[1m Bold
\033[4m underlined
\033[5m Blinking
\033[7m Reverse video
copy below lines into script and redirect output to file.
echo "\033[1m this a bold message\033[0m"
echo this is a normal message
echo "again normal"
echo "\033[1m again bold\033[0m"
echo "\033[7m reverse set ok\033[0m"
Thanks for the help. I tried these, it worked when I ran the commands on terminal.
But when I stored the echo in log file and vi log file, it shows something different.
e.g
$echo "\033[1m this a bold message\033[0m" > log
$ cat log
this a bold message
$ more log
this a bold message
$vi log
"log" 1 line, 29 characters
^[[1m this a bold message^[[0m
~
Similarly I downloaded the log file and opened in Microsoft word, it shows the result same as vi.
Do you know any commands or echo options which will store the character in file with special formatting which we specify with echo options.