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 Let me know,if anyone knows thanks & regards Swapna |
Hi and welcome to LinuxQuestions!
Code:
#!/bin/bash |
Thanks for the quick reply colucix
if i use like \033[1m and all the other stuff its printing command prompt of Putty. But the effect is not implied in a file I need to send a file to User in which the part of text sholud be in bold.... |
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 |
Hi,
you should create a file ($FILENAME ) which you will be sending in email format with HTML tags and body |
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 |
Quote:
Here we go: Code:
# Code:
gsub(/Fund name/,"<font color=\"#ff0000\">Fund name</font>") |
Hi colucix
When i tested your code, The code which you gave its giving error like Unmatched ' after awk command may i know what is the reason |
The only single quotes in my code are:
Code:
awk ' |
HI
Even now its getting the same problem Unmatched ' It works in csh shell script right? can you plz test itr once ... I need to send this report to my PD before i leave from office |
Quote:
Code:
#!/bin/bash |
Hiii,
I need to run my change only in csh Because i cant change the code and i dont have access to change the existing code,If i change the csh to bash entire shell script has to change Can anyone provide me any alternate idea/solution ,to get the part of data in bold in csh |
Hi colucix
if i tried your example using bash script itself gsub(/Fund name/,"<b>Fund name</b>") gsub(/1234/,"<b>1234</b>") Its prompting to enter the data after the execution of above 2 statements If i entered Fund name and 1234 or anything its not comming out of that loop and i need to press CTRL+C to get exit from the program Can you plz tell me how to avoid this problem |
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 ' |
All times are GMT -5. The time now is 12:00 PM. |