Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I currently have a file that I'd like to pass through a _roff to format with underline a few words in the file, and then view the file in less. Just a few, mind you, not whole sections or anything.

How do i underline specific words in a file with _roff?

NB: I know I have groff and nroff.
NNB: I don't know a whole lot about type formatting.

share|improve this question

1 Answer 1

At least with groff (I'm not sure it's portable), .ul gives you underline.

groff -Tascii <'<EOF'
This is a single line
.ul
with four underlined words
and more non-underline words.
EOF

If the only formatting you want is underlining, there may be an easier way. For example less automatically converts the sequence character-backspace-underscore (or underscore-backspace-character) to the underlined character; it also converts character-backspace-character to boldface.

echo $'one u\b_n\b_d\b_e\b_r\b_l\b_i\b_n\b_e\b_d\b_ word' | less
share|improve this answer
    
Your second suggestion - is this something less-specific? It sounds rather magical. –  J. Polfer Oct 12 '10 at 22:10
    
@sheepsimulator: Yes. See the description of the -u and -U in the less manual. Another less trick: LESS='+/ -u' man less –  Gilles Oct 12 '10 at 22:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.