Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] "M-" notation



On 07/06/2012 09:57 AM, Richard Pieri wrote:
> On 7/6/2012 6:56 AM, Daniel Feenberg wrote:
>> Actually, tab and NL are not translated. From the man page:
>>
>>     -v, --show-nonprinting
>>                use ^ and M- notation, except for LFD and TAB
>
> That's output from cat.  If you were to run the file through 'tr -d
> [:cntrl:]' then LFD and TAB characters would be removed.  That's the
> mess.  Go ahead and try it if you don't believe me.
>
>> 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.
>
> There are no "em minus space" characters.  They don't exist.  That is
> cat's human-readable translation of nonprinting characters.  If you
> want to remove these nonprinting characters then you have to do it by
> interpreted sequences (like "\a") or octal codes.
>
I've found that sed(1) tends to work well for me in my scripts. What I
do in the scripts is something like:
# make a backup
mv foo foo.orig
# remove CR and convert tabs to space
sed foo.orig -e 's/\r//g' -e 's/\t/ /g' > foo


-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix
PGP key id:3BC1EB90 
PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66  C0AF 7CEA 30FC 3BC1 EB90





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org