how to print part of text of a text file in bold and color using shellscript
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to print part of text of a text file in bold and color using shellscript
Hi all,
I need a help...
i have a procedure say X
output of X is :
Fund name: Mutual
NAV is: 1234
So i appended this output into a file using shellscript
But now my requirement is changed
the part of output like Fund name and 1234 should be in bold..
How can i do this using shell script
Here the -e option enables interpretation of backslash escapes. The ANSI escape sequences\033[1m and \033[0m switch the bold text on and off respectively. You can also use the sequences to colorize the text. Please see http://www.tldp.org/LDP/abs/html/colorizing.html for more details.
You cannot embed color information in a plain text file. It is the application that reads the file that colorizes the output (like echo in the example above), but there is no bold or colorized text inside the file itself.
In shell script,
filename may not be only plain text,I tested with .rtf and .html and .c and also with .s
its not displayin g in bold ,instead the file is having \033[1m Test as the data
======
echo "CALLING THE PROCEDURE"
setenv DBSQL "exec PROCEDURENAME"
mail -s "Message Title" $EMAILTO < $FILENAME
=====
The above procedure displays
FundName : Mutual
NAV is 1234
====
So i appended this output into $FILENAME and i need to mail this content of a file to user and the content is displayed in BODY of mail
So,i need a part of text in BOLD
How can we embed the dynamic procedure ouput into $FILENAME if we specify the HTML tags
the output sholud embed into the Body of MAIL with the BOLD data
So i appended this output into $FILENAME and i need to mail this content of a file to user and the content is displayed in BODY of mail
So,i need a part of text in BOLD
This is another story! You need the mail body to be colorized, not the text file, right? First the mail need to be in HTML format, since a plain text mail body cannot manage color information. Then you have to transform the text file into HTML code.
The gsub statements are part of the awk script, they should not ask for user input, unless you don't pass any argument (that is the file to process) to awk.
Anyway, the suggested code should work even in csh with slight modification. The awk part is the same. /bin/csh does not accept the single quote at the end of the line
Code:
awk '
Maybe you need to put a backslash at the end of each line to tell the shell that the command continues on the next line. I cannot try on a C-shell right now, but I will do within today. So stay tuned, coming back soon!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.