Visit Our UNIX and Linux User Community


Printing coloured lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Printing coloured lines
# 1  
Old 09-20-2009
Bug Printing coloured lines

I want to print "Hello,How are you" in green colour using printf. How to do so?
# 2  
Old 09-20-2009
this works in AIX...
Code:
printf "\033[1;32mHello,How are you?\033[m"

# 3  
Old 09-20-2009
MySQL echo

echo -e "\033[1;32mHello,How are you?\033[m" also gives the same output.

Is there any advantage or disadvantage of printing lines with echo with respect to printf?
# 4  
Old 09-20-2009
printf comes with lot more options like formatting the o/p etc etc...
depending upon use we use either echo or printf...
# 5  
Old 09-20-2009
printf tutorial

could you suggest me a good tutorial on the internet for printing coloured output using printf or echo...

---------- Post updated at 03:28 PM ---------- Previous update was at 03:09 PM ----------

How to print "hi how are you" in green coloured underlined text?

Plz help....

---------- Post updated at 03:29 PM ---------- Previous update was at 03:28 PM ----------

How to print "hi how are you" in green coloured underlined text?

Plz help....

---------- Post updated at 03:31 PM ---------- Previous update was at 03:29 PM ----------

How to print "hi how are you" in green coloured underlined text?

Plz help....

---------- Post updated at 03:31 PM ---------- Previous update was at 03:31 PM ----------

How to print "hi how are you" in green coloured underlined text?

Plz help....
# 6  
Old 09-20-2009
this will do...
Code:
printf "`tput smul`\033[1;32mHello,How are you?\033[m`tput rmul`"


Last edited by vidyadhar85; 09-20-2009 at 05:58 PM..

Previous Thread | Next Thread
Test Your Knowledge in Computers #640
Difficulty: Medium
After the purchase of NeXT by Apple, NeXT became the source for macOS, iOS, watchOS, and tvOS.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Printing out lines that have the same value in the first column but different value in the second

Hi, I have a text file that looks like the following: ILMN_1343291 6 74341083 74341772 ILMN_1343291 6 74341195 74341099 ILMN_1343295 12 6387581 6387650 ILMN_1651209 1 1657001 1657050 ILMN_1651209 5 83524260 83524309 I... (1 Reply)
Discussion started by: evelibertine
1 Replies

2. Shell Programming and Scripting

At A Glance Coloured Real Time Bargraph Generator...

Not sure if anyone is interested but I am just getting into UNIX like shell scripting... I have great interest in pseudo-animations in text mode and accessing HW like /dev/dsp for example... ... Have fun, I do... ;o) # !/bin/sh # # Bargraph_Generator.sh # # A DEMO 6 bit coloured... (0 Replies)
Discussion started by: wisecracker
0 Replies

3. Shell Programming and Scripting

printing lines before and after a record

Hello Everyone, I want to print out the records after and before a certain record. I am able to figure out how to print that particular record but not the ones before and after. Looking for some advice Thank you (6 Replies)
Discussion started by: danish0909
6 Replies

4. Shell Programming and Scripting

Printing the lines of the string with highest value

Please help . The script need to first grep for all lines with "C:" as it contains a value Here the value is 0 1,00: This , is a good script c:0 and then give output of the lines with top 3 highest value for c: 1,00: This , is a nice script c:9999 1,00: This , is a... (3 Replies)
Discussion started by: necro98
3 Replies

5. Shell Programming and Scripting

Printing the lines that appear in an other file, and the three lines after them

Hi ! I need some help with a script I am writing. I am trying to compare two files, the first file being in this format : Header1 Text1-1 Text1-2 Text1-3 Header2 Text2-1 etc... For each header, I want to check if it appears in the second file, and if it is the case print the header... (4 Replies)
Discussion started by: jbi
4 Replies

6. Shell Programming and Scripting

Printing all lines before a specific string and a custom message 2 lines after

Hello all, I need to print all the lines before a specific string and print a custom message 2 lines after that. So far I have managed to print everything up the string, inclusively, but I can't figure out how to print the 2 lines after that and the custom message. My code thus far is:... (4 Replies)
Discussion started by: SEinT
4 Replies

7. Shell Programming and Scripting

selective printing of lines

Hi all , i need to grep for a string in a text file and print the string and the 3rd line above it. As always , Thanks. (4 Replies)
Discussion started by: okiedokie
4 Replies

8. Solaris

To print Coloured Prelogin Message on SOLARIS--9................

Hiiii..... Every one...... I am using /etc/issue file to display Pre-login Message on my system, installed with SOLARIS-9. I am getting this Message in White fonts having Black background ( Colour of the Screen)..... So, is there ... (2 Replies)
Discussion started by: prashantshukla
2 Replies

9. Shell Programming and Scripting

Printing specified lines only

hi, i m having 2 files say F1 and F2. there are some joining conditions like: Column 4 from F1= Column 29 from F2; Column 10 from F1= Column 165 in F2; and if value in column 8 from F2='3' than i should get Column 4,5,8,10 from F1 and 29,165 from F2. I cant provide the files. but the... (4 Replies)
Discussion started by: Mohit623
4 Replies

10. Programming

Suppress last N lines printing

Hi, I want to know different ways of suppressing printing of last N lines. Can anyone help? Thanks, Sree (1 Reply)
Discussion started by: chakri400
1 Replies

Featured Tech Videos