[Discuss] "M-" notation

Richard Pieri richard.pieri at gmail.com
Thu Jul 5 20:35:57 EDT 2012


On 7/5/2012 8:00 PM, Daniel Feenberg wrote:
> "cat -v" has acquired something new called "M-" notation. It is
> mentioned but not described in the man page for cat,

        -v, --show-nonprinting
               use ^ and M- notation, except for LFD and TAB

"--show-nonprinting" seems self-explanatory.

> but apparently tr doesn't support it.

Because the option is for humans to read, not for programs to parse.  In
other words, it's "make all the nonprinting characters printing for my
benefit just this once."

> Any suggestions on how to delete all the "M- " characters from a
> file?

You don't, because that includes tabs and end-of-line characters.  If
you want to remove specific characters then do so with sed or 'tr -d'
and with the appropriate interpreted sequences or octal codes.  If you 
try to do it with 'tr -d [:cntrl:]' then you'll end up with a mess.

-- 
Rich P.




More information about the Discuss mailing list