Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

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


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.