Change the font of text in output file in shell scipt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Change the font of text in output file in shell scipt
# 1  
Old 05-18-2011
Question Change the font of text in output file in shell scipt

hi,

I want to change the font of text in output file. Smilie

I tried the below code
code:
Code:
if awk 'BEGIN{if('$RSS'>='1000')exit 0;exit 1}'
then
RED=`echo "\033[31m"`
echo "${RED} $Process exceeds 1000M on $PID \033[0m" >>output.txt
else
GREEN=`echo "\033[32m"`
echo "${GREEN} Memory Utilization is normal for $Process on $PID \033[0m" >>output.txt
fi

i can see colors in terminal but not in output file Smilie

please help me how i can get colors text in output file.

Moderator's Comments:
Mod Comment edit by bakunin: Please use CODe-tags when posting code or terminal output to enhance readability. With so many posts under your belt you could know that already.

Last edited by bakunin; 05-18-2011 at 02:48 AM.. Reason: code taqgs
# 2  
Old 05-18-2011
Quote:
Originally Posted by sreelu
hi,

I want to change the font of text in output file. Smilie

I tried the below code
code:
Code:
if awk 'BEGIN{if('$RSS'>='1000')exit 0;exit 1}'
then
RED=`echo "\033[31m"`
echo "${RED} $Process exceeds 1000M on $PID \033[0m" >>output.txt
else
GREEN=`echo "\033[32m"`
echo "${GREEN} Memory Utilization is normal for $Process on $PID \033[0m" >>output.txt
fi

i can see colors in terminal but not in output file Smilie

please help me how i can get colors text in output file.
Code:
if awk 'BEGIN{if('$RSS'>='1000')exit 0;exit 1}'
then
RED="\033[31m"
echo -e "${RED} $Process exceeds 1000M on $PID \033[0m" >>output.txt
else
GREEN="\033[32m"
echo -e "${GREEN} Memory Utilization is normal for $Process on $PID \033[0m" >>output.txt
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Change text font to greater one in this very good MOTIF texteditor ?

Hi, i have here found a very good texteditor source code programmed in the MOTIF GUI language. For myself i need NOTHING else to program. To start from a very easy point of view i want to RUN this editor on my LINUX machine and type simple C code. The reason for this post is that the text... (7 Replies)
Discussion started by: Sennenmut
7 Replies

2. UNIX for Beginners Questions & Answers

Need list of input and output parameter of task in a text file, using shell script

//file begin ===== //some code task abcd_; input x; input y,z; //some comment output w; //some comment reg p; integer q; begin //some code end endtask : abcd_ //some code //file end ===== expected output from above... (1 Reply)
Discussion started by: rishifrnds
1 Replies

3. Shell Programming and Scripting

output text in bold font using SED

hi I want to write a script, while using the SED editor, to output the text, in this case a variable, to the result file but highlighted it in bold, is it possible to do that? can you tell me how? eg. in text.txt sed '$ a\ '$variable' ' <text.txt >text2.txt so it will add the... (2 Replies)
Discussion started by: piynik
2 Replies

4. Shell Programming and Scripting

generate tabular output from an input text file in unix shell scripting

Hi, I have the output (as below) which i want it to be in a table. For e.g. space utilization in PSE on path /logs is 0% space utilization in PSE on path /logs/tuxedo/tuxlsp is 16% space utilization in PSE on path /ldvarlsp/lsp/log is 37% space utilization in PSE on path /home is 6%... (7 Replies)
Discussion started by: pkbond
7 Replies

5. Shell Programming and Scripting

Change the font of the attached file while using sendmail

Hi, I have one file which needs to be mailed through sendmail. I am using the following command to send this file to end users. But before sending how can I change the font of the input file to "Courier New" as the mail content was not in proper format if it is any other font. printf... (1 Reply)
Discussion started by: Kattoor
1 Replies

6. AIX

how to change the font size of shell in $ prompt

Can any help me to change the default font type and its size.. To clear more about my question.. Once i login to my unix domain... the font it displaying is of small size... all my shell commands i am executing in $ prompt also carries the same style(ls, date and echo...) i searched whole... (2 Replies)
Discussion started by: tsjpraveen
2 Replies

7. Shell Programming and Scripting

how to make a line BLINKING in output and also how to increase font size in output

how to make a line BLINKING in output and also how to increase font size in output suppose in run a.sh script inside echo "hello world " i want that this should blink in the output and also the font size of hello world should be big .. could you please help me out in this (3 Replies)
Discussion started by: mail2sant
3 Replies

8. Shell Programming and Scripting

running db2 sql and exporting output from ksh scipt

Hi there, I am trying to write a shell script as root on AIX 5.3 where I change user to db2inst1, connect to our db2 database, run a sql select query and export the result of the query to a file. The code I have so far is as follows:- #!/usr/bin/ksh su - db2inst1 -c "db2 connect to... (0 Replies)
Discussion started by: candlino
0 Replies

9. UNIX for Dummies Questions & Answers

How to change the font or color of text

Hi Gurus, I have a small requirement where i want to change the color & font of some text in a file. i have a file error.txt which will be created in the script using egrep. After that iam adding these lines at head & tail to that file using the following code awk 'BEGIN{print"Please... (4 Replies)
Discussion started by: pssandeep
4 Replies

10. Shell Programming and Scripting

Hw to change the font of output in perl

Hw to change the font color and size of output in perl (2 Replies)
Discussion started by: trupti_rinku
2 Replies
Login or Register to Ask a Question