this post was submitted on 13 Apr 2025
123 points (92.4% liked)

Linux

7029 readers
268 users here now

A community for everything relating to the GNU/Linux operating system

Also check out:

Original icon base courtesy of [email protected] and The GIMP

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 6 days ago

Relevant except below, bolded is the key point.

-v prints non-printing characters in a visible representation. Making strange characters visible is a genuinely new function, for which no existing program is suitable. (sed -n l, the closest standard possibility, aborts when given very long input lines, which are more likely to occur in files containing non-printing characters.) So isn’t it appropriate to add the -v option to cat to make strange characters visible when a file is printed?

The answer is "No." Such a modification confuses what cat’s job is  concatenating files  with what it happens to do in a common special case  showing a file on the terminal. A UNIX program should do one thing well, and leave unrelated tasks to other programs. cat’s job is to collect the data in files. Programs that collect data shouldn’t change the data; cat therefore shouldn’t transform its input.