Sponsored Content
Full Discussion: sed colour change
Top Forums Shell Programming and Scripting sed colour change Post 302815173 by bakunin on Friday 31st of May 2013 05:57:27 AM
Old 05-31-2013
You can do that, but the colour change depends on which terminal you use to display the email. Look up "termcap" or "terminfo" ("terminfo" is the more modern one, depending on your system it is preferable) in the man pages and then find out which terminal (emulator) you are using, then use "sed" to insert the respective sequence:

Code:
# get these from terminfo
switch_2_white=""....some sequence..."
switch_2_red="....some sequence..."
switch_2_green="....some sequence..."

sed -e 's/PASSED/'"$switch_2_green"'&'"switch_2_white"'/g' \
        s/BACKUP FAILED/'"$switch_2_red"'&'"switch_2_white"'/g'

I hope this helps.

bakunin
 

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
TERMCAP(3)						   BSD Library Functions Manual 						TERMCAP(3)

NAME
tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs -- terminal independent operation routines LIBRARY
Termcap Access Library (libtermcap, -ltermcap) SYNOPSIS
#include <termcap.h> char PC; char *BC; char *UP; int tgetent(char *bp, const char *name); int tgetnum(const char *id); int tgetflag(const char *id); char * tgetstr(const char *id, char **area); char * tgoto(const char *cm, int destcol, int destline); DESCRIPTION
These functions extract and use capabilities from a terminal capability database. They exist as wrappers around equivalent terminfo(3) func- tions, which new code should use. These are low level routines; see curses(3) for a higher level package. The tgetent() function calls setupterm() and configures PC, UP and BC. Only PC is actually used internally. The tgetent() function returns -1 if none of the terminfo data base files could be opened, 0 if the terminal name given does not match an entry, and 1 if all goes well. The bp argument is not used. The tgetnum() function gets the numeric value of the capability id, returning -1 if it is not given for the terminal. The tgetflag() func- tion returns 1 if the specified capability is present in the terminal's entry, 0 if it is not. The tgetstr() function returns the string value of the capability id. This is a terminfo(5) string and not a termcap string; as such it should only be processed by tgoto(). The tgetstr() function returns NULL if the capability was not found. The area argument is unused. The tgoto() function returns a cursor addressing string decoded from cm to go to column destcol in line destline, or NULL on error conditions such as out of memory. Please note that tgoto() can return an incomplete value on a malformed input sequence. Historically tgoto() used to return ``OOPS'' on those conditions, so newer programs should now be checking the return value. SEE ALSO
terminfo(3), terminfo(5) HISTORY
termcap first appeared in 4.0BSD. NetBSD 1.5 introduced some termcap t_*() extensions which were removed in NetBSD 6.0 when terminfo(3) was introduced. AUTHORS
Roy Marples <roy@NetBSD.org> BSD
March 14, 2011 BSD
All times are GMT -4. The time now is 01:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy