Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Dec 2003 14:52:06 -0000
From:      "Simon Gray" <simong@desktop-guardian.com>
To:        "Bryan Cassidy" <b_cassidy@bellsouth.net>, <freebsd-questions@freebsd.org>
Subject:   Re: Remove ^M characters from xhtml file
Message-ID:  <0d9f01c3b81a$b10a2b40$1100a8c0@dtg17>
References:  <20031201031602.GA80581@bsdjunky.homeunix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> I've downloaded a couple of .xhtml files and they have ^M characters
> all through it. I tried the col -b < name > newname command on these
> files but when I do that it erases the whole document. Any ideas?


handy little shell script i found a while ago which does exactly what you're
after


#!/bin/sh
# rmc.sh
# remove ^M characters
#
# slee 021116
# http://freebsd.mu

if [ $# -eq 1 ]
then
tr -d '\015' < $1 > $1.tmp.$$
mv -f $1.tmp.$$ $1
else
echo "Usage: $0 filename"
fi


Just place within /usr/local/bin and do 'chmod +x /usr/local/bin/rmc.sh'
then just do 'rmc.sh file' as and when you need.

HTH

Simon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0d9f01c3b81a$b10a2b40$1100a8c0>