• 0 Posts
  • 1 Comment
Joined 2 years ago
cake
Cake day: June 10th, 2023

help-circle
  • 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.