Sponsored Content
Full Discussion: sed colour change
Top Forums Shell Programming and Scripting sed colour change Post 302815157 by Bdoydie on Friday 31st of May 2013 05:11:04 AM
Old 05-31-2013
sed colour change

Hi,
I am trying to write a script which will email a backup report from the server,

The contents of the email will be:

Code:
 ---------------------- ---- -- ---- ----- ---- ------- ---- ------- -------
|                      |    |  |    |Chnge|Wkng|       |    |       |       | 
|                      |    |  |    |Tape |Bckp|Write  |Vrfy|Verify |Backup |
|         Date         |Type|Id|No.T|Time |Time|Status |Time|Status |Status |
|----------------------|----|--|----|-----|----|-------|----|-------|-------|
| Fri May 31,2013 02:30|FULL|10|   1|    0| 195| PASSED| 228| PASSED| PASSED|
| Thu May 30,2013 18:45|FULL|10|   1|    0| 195| PASSED| 230| PASSED| PASSED|

I was wondering if there is a way using sed or similar to change the colour of the word Passed to green, and if the backup fails the word failed to red,
eg
Code:
 ---------------------- ---- -- ---- ----- ---- ------- ---- ------- -------
|                      |    |  |    |Chnge|Wkng|       |    |       |       | 
|                      |    |  |    |Tape |Bckp|Write  |Vrfy|Verify |Backup |
|         Date         |Type|Id|No.T|Time |Time|Status |Time|Status |Status |
|----------------------|----|--|----|-----|----|-------|----|-------|-------|
| Fri May 31,2013 02:30|FULL|10|   1|    0| 195| PASSED| 228| PASSED| PASSED|
| Thu May 30,2013 18:45|FULL|10|   1|    0| 195| PASSED| 230| PASSED| PASSED|
| Thu May 30,2013 02:30|FULL| 9|   1|    0| 195| PASSED| 229| PASSED| PASSED|
| Wed May 29,2013 18:45|FULL| 9|   1|    0| 195| PASSED| 230| PASSED| PASSED|
| Wed May 29,2013 02:30|FULL| 8|   1|    0| 195| PASSED| 228| PASSED| PASSED|
| Tue May 28,2013 18:45|FULL| 8|   1|    0| 196| PASSED| 230| PASSED| PASSED|
| Tue May 28,2013 02:30|FULL||**BACKUP FAILED**
| Mon May 27,2013 18:45|FULL||**BACKUP FAILED**

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

HOw to change the text colour through shell script?

Hi all, I have written one script. If i run the script, particular text in that script needs to be displayed in color.how this could be done?any commands r there to change the colour of the text while running the script? Ur help is appreciated !!! Thanx in Advance, Sona. (7 Replies)
Discussion started by: Sona
7 Replies

2. Shell Programming and Scripting

VT100 terminal and colour

Good day all I am looking for a way to change colours in a text file that get tailed. I have tried using tput, however this does not seem to work. terminal type is using putty and vt100 emulation. Any ideas. :rolleyes: Thanks J (6 Replies)
Discussion started by: jhansrod
6 Replies

3. Shell Programming and Scripting

How to change the font colour in unix ?

Could you pls tell me how to change the font colour in unix ? What is the syntax ? (3 Replies)
Discussion started by: sars
3 Replies

4. HP-UX

How to change font and colour in mail sent from Unix

Dear All, We have following code to send mails from unix to users. We want to see few sentences of mail in bold font or to hightlight few lines in different colours. Could you please let me know how can we do it in function construct_body. ... (3 Replies)
Discussion started by: yogichavan
3 Replies

5. Shell Programming and Scripting

ksh, font colour

hi all, how do i change the colour of text if i am using printf ?? in my script i am printing out response times from the server and i wanted to print out the max response time in red. ta. (1 Reply)
Discussion started by: cesarNZ
1 Replies

6. HP-UX

hpux top colour

Hello, is there some way to change b/w colour of top command output in hpux B.11.31 ? (1 Reply)
Discussion started by: tonijel
1 Replies

7. UNIX for Advanced & Expert Users

To change the colour of the content in email sent through unix

Hi I want to change the color of the email content sent through unix. I tried a lot and left in vain. I heard that it could be done by sending the email as HTML. But I don't how to do it. Can you all share your ideas? ~sakthifire (1 Reply)
Discussion started by: sakthifire
1 Replies

8. Programming

Cshell help with change colour in print

i want to ask how to change the colour of prompt message from use? and also how to change colour in printing........ i want to change it as blue colour and red colour, but i found many website still don't know how to do. how's the command is wrote? thz really!! (1 Reply)
Discussion started by: wendy1089
1 Replies

9. AIX

putty background colour change in vi editor

Hello, I have a problem with my putty session when i use the vi editor or when i do dbaccess on an Informix database. Suddenly the background and foreground colour of my terminal change and it makes it difficult for me to see whats on the screen. Why this is happening? Is there a way to keep... (2 Replies)
Discussion started by: omonoiatis9
2 Replies
set_color(1)							       fish							      set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 07:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy