0

required output of echo in bold letters

while using echo command I want the content to be bold and it should have same bold view while appending echo output to the file

echo "hi">test.txt

i want hi should be in bold in the test.txt file

3
  • A text file is just plain text, no font-formatting such as bold or italics. You'll need to use a different file format Aug 2, 2014 at 3:39
  • @ElefantPhace:CAn you let me know while echo command when i append it to a file i need to see characters in bold which format would support it. Aug 3, 2014 at 10:01
  • You can't do it. Not in a plain text file. Aug 3, 2014 at 13:01

1 Answer 1

1

.txt is a raw text format: you can't use any type of text-formatting.

Some "generic" conventions are **Bold** and *italic* because a lot of markdown will interpret these as bold and italic.

Another thing that could be usefull to display a bold text is to use bash. But it will of course only work in you display the .txt in a bash-terminal. For this, you can use something like echo -e "\033[1mThis text is bold", but it will be copied 'as it' in the .txt file.

6
  • An easier option in bash would be to use echo $(tput bold)This is bold Aug 2, 2014 at 3:52
  • Yes the above code in terminal makes it bold but when same is appendind to a text file it shows as its is.so i want to see same bold ouput inside a file.. Aug 3, 2014 at 9:44
  • @ElefantPhace:the output inside file shows as [1m this is bold Aug 3, 2014 at 9:46
  • Hi @ElefantPhace:its same while running the tput has same issue I am able to see characters [1m hi inside a.txt file code ran is as below. echo $(tput bold) hi>a.text Aug 3, 2014 at 9:53
  • ".txt is a raw text format: you can't use any type of text-formatting." The first line of my answer.
    – MrVaykadji
    Aug 3, 2014 at 10:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .