[Discuss] "M-" notation
Charlie Bennett
ccb at acm.org
Fri Jul 6 08:52:07 EDT 2012
Daniel -
Use od -c on the file to figure out what the OCTAL codes are for the
characters in question. Use '\NNN' with tr to remove the chars with
those OCTAL codes.
ccb
On Fri, 2012-07-06 at 06:56 -0400, Daniel Feenberg wrote:
>
> On Thu, 5 Jul 2012, Richard Pieri wrote:
>
> > 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
>
> Actually, tab and NL are not translated. From the man page:
>
> -v, --show-nonprinting
> use ^ and M- notation, except for LFD and TAB
>
> I just tested it, the man page is almost right in that CR is also not
> translated. Anyway, I don't want to delete all the "M-" characters, just
> "M- " (em minus space). That character acts like a tab on my terminal, but
> seems to be a tab with the high bit set.
>
> > 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.
> >
> > _______________________________________________
> > Discuss mailing list
> > Discuss at blu.org
> > http://lists.blu.org/mailman/listinfo/discuss
> >
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://lists.blu.org/mailman/listinfo/discuss
More information about the Discuss
mailing list