Help with underline text based on specific region


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with underline text based on specific region
# 8  
Old 03-18-2013
Hi mjf,

Do you have any idea regarding "write an Excel formula or some VBA code to handle the underlining part" that you mention?

Sorry that I lack of experience when dealing with this type of data set Smilie
# 9  
Old 03-18-2013
I'd be very surprised if you get the EXCEL formatting into a plain text file. If you do, please keep me informed!
What you can do is insert terminal/console control chars into your text. See man console_codesExample (use editor of choice):
Code:
$ cat -v file
provider ^[[4m   telecom   ^[[0m -view ...
          ^---underline on  ^--- reset = no ul

The ^[ in each "escape sequence" is the <ESC> char (ASCII 27, 0X1B, \033). Try to print above sequence to your terminal and see...
# 10  
Old 03-18-2013
If you choose the Excel route, here is an "untested" example of how to do such using VBA in Excel:

If cell A1 contains the starting point, cell B1 contains the ending proint and
the string is in cell C1 (your active cell), then underline that range.
Code:
 
ActiveCell.Characters(A1,B1).Font.Underline = True

 
There is a bit more to it then that but that's for another forum.
This User Gave Thanks to mjf For This Post:
# 11  
Old 03-18-2013
With your sample file from post#1:
Code:
awk     'BEGIN {ULON="\033[4m"; RST="\033[0m"}
               {$3 = substr($3,1,$1-1) ULON substr($3,$1,$2-$1+1) RST substr($3,$2+1)}
         1
        ' file
2 5 ASFGEWTEWRQWEQ
10 20 QEWIORUEIOUEWORUQWEQWRQRQWGQWGFQ
1 6 WRQTQWTQTQWTQT

You can't see the underline in this post; try on a terminal.
This User Gave Thanks to RudiC For This Post:
# 12  
Old 03-18-2013
Hi RudiC,

Sorry for misleading.
I should said that I save a file in *.txt format and I used microsoft excel to open the *.txt.
After then, manual underline the region of interest previously.

Do you mind to share more how to underline or bold my content in terminal?
I did try your method, but it seems like can't work.
Maybe I misunderstanding your command Smilie

Below is my input file:
Part of long list of Input file
Code:
3 10 QWETRQWTQWRQWEQEQGTQWTQGTQWTRQWGTQWERQW

Desired output
Code:
3 10 QWETRQWTQWRQWEQEQGTQWTQGTQWTRQWGTQWERQW

"ETRQWTQW" should be underline automatic by your program/script if possible.

Many thanks.

---------- Post updated at 09:44 AM ---------- Previous update was at 09:36 AM ----------

Hi RudiC,

Many thanks for reply.
I have a try by using Ubuntu terminal then.

Thanks a lot.
I will update you once the result is out.
# 13  
Old 03-19-2013
Hi RudiC,

After I try your awk command, it able to shown underline of region interest through terminal.
However when I open those *.txt by Microsoft Excel or Notepad.
It shown some "SFGE[0mE" rather than shown underline at region interested.

My main purpose was hope that able to figure a way or method that able to underline region interest and it able to shown when I open through Microsoft Excel.

Thanks a lot and again.
# 14  
Old 03-20-2013
You did not mention to use EXCEL in your specification. EXCEL is showing exactly what you put in: the console code to switch underline on, the text, the code to switch ul off.
EXCEL underline and terminal underline are two completely different and incompatible things.

Still you may code a VBA script to turn the console codes to sth EXCEL understands...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert header with underline?

How to insert header with underline AM able to insert only header not underline sed '1i NAME COUNTRY' test.txt input file UK 1234 USA 2354 AUS 2253 IND 4256 Output file NAME COUNTRY_CODE ---- ------------ UK 1234 USA 2354 AUS 2253 IND 4256 (5 Replies)
Discussion started by: Kalia
5 Replies

2. UNIX for Dummies Questions & Answers

How to cut from a text file based on value of a specific column?

Hi, I have a tab delimited text file from which I want to cut out specific columns. If the second column equals one, I want to cut out columns 1 and 5 and 6. If the second column equals two, I want to cut out columns 1 and 5 and 7. How do I go about doing that? Thanks! (4 Replies)
Discussion started by: evelibertine
4 Replies

3. Shell Programming and Scripting

Help with allocated text content based on specific rules...

Input file format: /tag="ABL" /note="abl homolog 2 /tag="ABLIM1" /note="actin binding LIM 1 /tag="ABP1" /note="amiloride binding protein 1 (amine oxidase (copper- containing)) /tag="ABR" /note="active BCR-related /tag="AC003042.1" /note="SDR family member 11 precursor . . . (4 Replies)
Discussion started by: perl_beginner
4 Replies

4. Shell Programming and Scripting

Assigning a specific format to a specific column in a text file using awk and printf

Hi, I have the following text file: 8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm 9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm 10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm 11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Discussion started by: goodbenito
2 Replies

5. Shell Programming and Scripting

[bash help]Adding multiple lines of text into a specific spot into a text file

I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it. For example, Here is a portion of a zone file. IN NS ns1.domain.tld. IN NS ns2.domain.tld. IN ... (2 Replies)
Discussion started by: cdn_humbucker
2 Replies

6. Shell Programming and Scripting

Bold and Underline - not displyed in more/less/vi

I have a script main.shl which has few lines like this #bold tput smso echo "\t\tsome statement\t\t" tput rmso I am executing the main.shl from the shell and redirected its output to a separate file like this $main.shl >main.log 2>&1 & once after running this script, if I "cat" the... (0 Replies)
Discussion started by: ramkrix
0 Replies

7. Shell Programming and Scripting

Extract lines of text based on a specific keyword

I regularly extract lines of text from files based on the presence of a particular keyword; I place the extracted lines into another text file. This takes about 2 hours to complete using the "sort" command then Kate's find & highlight facility. I've been reading the forum & googling and can find... (4 Replies)
Discussion started by: DionDeVille
4 Replies

8. Shell Programming and Scripting

Insert a text from a specific row into a specific column using SED or AWK

Hi, I am having trouble converting a text file. I have been working for this whole day now, still i couldn't make it. Here is how the text file looks: _______________________________________________________ DEVICE STATUS INFORMATION FOR LOCATION 1: OPER STATES: Disabled E:Enabled ... (5 Replies)
Discussion started by: Issemael
5 Replies

9. Shell Programming and Scripting

Underline

i want to print underline under a text using shell or awk.can any body help me regarding this problem? i hav tried with echo -e -n "\033$4}' like expected output is 123 456 12 122 567 13 211 087 14 311 987 15 like the avove Thank you regards, Pankaj. (2 Replies)
Discussion started by: panknil
2 Replies

10. UNIX for Dummies Questions & Answers

underline character in vi editor

I want to print a man page for a command in unix, this is what I did man command > command.txt but when I view the output file command.txt I found there are lot of _^H characters that in the man page are actually underline character, how can I replace this _^H with underline character? ... (2 Replies)
Discussion started by: Melissa
2 Replies
Login or Register to Ask a Question