Linked by Thom Holwerda on Wed 9th Aug 2017 21:50 UTC
General Unix

In what's never going to be a regular occurance, I'm linking to a Twitter thread. Chris Espinosa tweets:

Just as I was wrapping up an email and getting ready to leave work, a co-worker rolled his chair over to show me an "interesting" thing.

Go ahead, read it.

UNIX, man. Not even once.

Thread beginning with comment 647836
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: UNIX showing its age again...
by grat on Thu 10th Aug 2017 19:53 UTC in reply to "RE: UNIX showing its age again..."
grat
Member since:
2006-02-02

Luckily, there are convenient ways to automatically transform manpages into pure ASCII text (no more highlighting, reverse, underlining) or to PDF, especially because PDF is a very popular document exchange format.


I wouldn't consider most of your examples to be "convenient". I recall piping the output of man to nroff, but that's a really old memory.

Personally, I find that

man ls > ls.txt

is all I need to do under my current bash environment.

Reply Parent Score: 2

Doc Pain Member since:
2006-10-08

I wouldn't consider most of your examples to be "convenient". I recall piping the output of man to nroff, but that's a really old memory.

Personally, I find that

man ls > ls.txt

is all I need to do under my current bash environment.


When I do this in my (home) UNIX environment (not Linux, not bash), I get a text file with control characters (the ^H as backspace for "overprinting" as well as the double characters and the _ underlining). Example line:

-^H-D^HD _^Hf_^Ho_^Hr_^Hm_^Ha_^Ht

This is the text found in the text file for

-D format

Reading the file with "less ls.txt" again restores the look of the manpage including highlighted and underlined characters, in this example, "-D" printed bold, and "format" underlined. Outputting it with "cat ls.txt" directly to the terminal does not display the control characters - normal text is written to the terminal. But they are still there - "cat ls.txt | less" leads to the "manpage style" again.

It might be possible that in your environment the control characters are stripped automatically. Maybe your man's roff implementation (nroff, groff, troff, etc) behaves different, maybe the shell changes $PAGER for the process to something else than the traditional "less" upon redirection...

Reply Parent Score: 2

Soulbender Member since:
2005-08-18

man ls > ls.txt


Gives a correctly formatted text file on Ubuntu 17.04.

Reply Parent Score: 2

grat Member since:
2006-02-02

It might be possible that in your environment the control characters are stripped automatically. Maybe your man's roff implementation (nroff, groff, troff, etc) behaves different, maybe the shell changes $PAGER for the process to something else than the traditional "less" upon redirection...


I actually expected the behavior you saw-- even did hexdump -C to verify there are no hidden control characters.

Interestingly, under FreeBSD, I get the behavior described above-- control characters and double-characters for bold text.

Reply Parent Score: 2