Highlight the string displayed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Highlight the string displayed
# 1  
Old 10-21-2010
Highlight the string displayed

Hi,

Want to highlight the string displayed on the screen.

Code:
ften="File selected"
FB1="\e[1m"
FB2="\e[0m"
printf "$FB1\nften$FB2\n"
echo "exp_trn_backups_12_Oct_2010_10_52_00.dmp" | awk -F"_" '{printf "This will make data available till date " $4"-"$5"-"$6 " and time " $7":"$8":" substr($9,1,(length($9)-4))}'
echo ""

From the above code,

String "File selected" gets highlighted, but the string in the next line does not get highlighted.

I tried using FB1& FB2 variables but didn't worked out may be due to too many double quotes in the string.

How can it be done ?

With Regards
# 2  
Old 10-21-2010
Do you mean like this:
Code:
printf "$FB1%s$FB2\n" "$(echo "exp_trn_backups_12_Oct_2010_10_52_00.dmp" | awk -F"_" '{printf "This will make data available till date " $4"-"$5"-"$6 " and time " $7":"$8":" substr($9,1,(length($9)-4))}')"

or:
Code:
ften="File selected"
FB1="\e[1m"
FB2="\e[0m"
printf "$FB1"
echo "$ften"
echo "exp_trn_backups_12_Oct_2010_10_52_00.dmp" | awk -F"_" '{printf "This will make data available till date " $4"-"$5"-"$6 " and time " $7":"$8":" substr($9,1,(length($9)-4))}'
printf "$FB2"

Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[zenity] string is not displayed

I am trying to display a string in zenity: chars="\, /, <, >, ?, |, &, $" echo $chars \, /, <, >, ?, |, &, $ Now when I execute: zenity --forms --text="Chars not allowed: $chars" --add-entry="File Name" Instead of getting Chars not allowed: \, <, >, ?, |, &, $ I am getting Forms... (3 Replies)
Discussion started by: soichiro
3 Replies

2. Shell Programming and Scripting

HOW TO HIGHLIGHT FIRST LINE IN FILE?

Hi I have a file as below Merchandise hfdlshaflkdahfdsafhdahfdafhf aldfhdafjadjfsdjfdsjflsjdfjsfjfjs jfahfadhfahdfahfahfahfadhfad Requiremnt: I need to Highlight first line of the file in Bold letters/With Colors and font size change is it possible? (3 Replies)
Discussion started by: buzzme
3 Replies

3. UNIX for Dummies Questions & Answers

Highlight text in shell o/p

Hi All, Can anyone tell me how to highlight a particular text in shell output or formattting a text in shell ? (1 Reply)
Discussion started by: prasanna2166
1 Replies

4. UNIX for Dummies Questions & Answers

vim font highlight

Hi, there. I am using vim to edit some files I am working on from terminal. I occasionally pressed some keys by mistake, and the word just got highlight. Afterward whenever I type in that word, it will be highlight automatically. It is annoying. Could someone tell me how to turn this off? BTW,... (6 Replies)
Discussion started by: HOUSCOUS
6 Replies
Login or Register to Ask a Question