Re: Remove ^M characters from xhtml file
in message [EMAIL PROTECTED], wrote Rob Ellis thusly... On Tue, Dec 02, 2003 at 05:53:59PM -0500, parv wrote: It pains me not to see even a mention of sed ... To rectify the situation... sed -e 's/^M$//' old new mv -f new old Freebsd's sed has -i sed -ie 's/^M$//' old I forgot about that; thanks for the reminder. - Parv -- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
* paul beard [EMAIL PROTECTED] [2003-12-01 03:07]: On Nov 30, 2003, at 6:53 PM, Melvyn Sopacua wrote: BTW: why is this even an issue that needs a solution? XHTML doesn't care one way or the other, since all linear spacing is folded into one space. It's distracting to look at all that stuff if you're editing in vi, I have the following line in my .vimrc set fileformats=unix,mac,dos which hides the ^Ms, but doesn't remove them - useful in a cross-platform environment, because Windows users don't complain about their line breaks breaking, if they access the file again :) cheers, /loz. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
FWIW, I'm attaching 'cvt' that I've used for years. It does conversions between dos, unix, vax, mac quite cleanly. Just untar and type make unix. Put the cvt binary into your ~/bin directory. % cvt -u files translates files from whatever fmt to Unix fmt. gary PS: are there any vaxen left? :-) -- Gary Kline [EMAIL PROTECTED] www.thought.org Public service Unix ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Wed, Dec 03, 2003 at 11:12:28AM -0800, Gary Kline wrote: FWIW, I'm attaching 'cvt' that I've used for years. It does conversions between dos, unix, vax, mac quite cleanly. Just untar and type make unix. Put the cvt binary into your ~/bin directory. % cvt -u files translates files from whatever fmt to Unix fmt. gary PS: are there any vaxen left? :-) Well, tar and shar were stripped by mailinglist... Anybody wants 'cvt' drop a line. --g -- Gary Kline [EMAIL PROTECTED] www.thought.org Public service Unix ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
in message [EMAIL PROTECTED], wrote Bryan Cassidy thusly... 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? Ah, a FAQ of comp.unix.* groups... http://groups.google.com/groups?q=remove+%22%5EM%22+file+group%3Acomp.unix.* It pains me not to see even a mention of sed, even though i prefer the perl pie solution myself. To rectify the situation... # one way to type ^M is: Ctrl-V followed by Ctrl-M sed -e 's/^M$//' old new mv -f new old - Parv -- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
Using Vi, use this command :1,$ s/ctrl-vctrl-m//g HTH James On Tue, 2 Dec 2003, parv wrote: in message [EMAIL PROTECTED], wrote Bryan Cassidy thusly... 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? Ah, a FAQ of comp.unix.* groups... http://groups.google.com/groups?q=remove+%22%5EM%22+file+group%3Acomp.unix.* It pains me not to see even a mention of sed, even though i prefer the perl pie solution myself. To rectify the situation... # one way to type ^M is: Ctrl-V followed by Ctrl-M sed -e 's/^M$//' old new mv -f new old - Parv -- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Tue, Dec 02, 2003 at 04:58:06PM -0600, James Schmidt wrote: Using Vi, use this command :1,$ s/ctrl-vctrl-m//g To save two keystrokes try this :-) :% s/ctrl-vctrl-m//g Marc -- Marc Wiz [EMAIL PROTECTED] Yes, that really is my last name. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Tue, Dec 02, 2003 at 05:53:59PM -0500, parv wrote: in message [EMAIL PROTECTED], wrote Bryan Cassidy thusly... 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? Ah, a FAQ of comp.unix.* groups... http://groups.google.com/groups?q=remove+%22%5EM%22+file+group%3Acomp.unix.* It pains me not to see even a mention of sed, even though i prefer the perl pie solution myself. To rectify the situation... # one way to type ^M is: Ctrl-V followed by Ctrl-M sed -e 's/^M$//' old new mv -f new old Freebsd's sed has -i sed -ie 's/^M$//' old - Rob ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Sun, 30 Nov 2003 21:39:33 -0600, Bryan Cassidy wrote: Well, I take that back. It worked on 1 file and then ir started erasing the contents of the file. tr -d \\r file tmp mv tmp file or col -b file tmp mv tmp file ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Sun, 2003-11-30 at 21:18, Alex de Kruijff wrote: On Sun, Nov 30, 2003 at 09:16:02PM -0600, Bryan Cassidy wrote: 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? There's a port called dos2unix of unix2dos that you could let loos on it. In ports: - converters/dosunix - converters/fconv - converters/ktextdecode - converters/unix2dos Charles Ulrich -- http://bityard.net ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
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 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
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? This is because the file was created in MS-land. On your FreeBSd system do: tr -d \r oldfile newfile and it will clear them up nicely. Note, only do this to text files. jerry ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
+++ Robin Schoonover [freebsd] [30-11-03 19:17 -0700]: | On Sun, 30 Nov 2003 21:16:02 -0600, Bryan Cassidy [EMAIL PROTECTED] | wrote: | 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? | | dos2unix (converters/unix2dos in ports) is an easy route (dos2unix name). | Also you can use the tr command (tr -d '\r' name newname). | | -- | Robin Schoonover (aka End) col -bx old.xhtml new.xhtml Shantanoo ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
Hello everyone, I'm very new to BSD this mailing list so please forgive me should I post incorrectly. Here are some links that may help you with removing the ^M character from any file!! http://www.unixblog.com/quick_unix_tips/remove_m_with_vi.php - I like this one personally, because I've used it before it worked!! http://www.introcomp.co.uk/general/remove_dos.html BigDaddyEBK Unix for Longevity AS/400 for Nostalgia Linux for Productivity MAC for Multimedia Windows for Solitaire Hello tech support? I broke the cup-holder on my computer!! Date: Mon, 1 Dec 2003 23:10:33 +0530 From: Shantanoo Mahajan [EMAIL PROTECTED] Subject: Re: Remove ^M characters from xhtml file To: Robin Schoonover [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii +++ Robin Schoonover [freebsd] [30-11-03 19:17 -0700]: | On Sun, 30 Nov 2003 21:16:02 -0600, Bryan Cassidy | [EMAIL PROTECTED] | wrote: | 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? | | dos2unix (converters/unix2dos in ports) is an easy route (dos2unix | name). | Also you can use the tr command (tr -d '\r' name newname). | | -- | Robin Schoonover (aka End) col -bx old.xhtml new.xhtml Shantanoo ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
I found this one that works cat [filename] | tr -d '/r' out; mv out [new filename] Mark - Original Message - From: Big Daddy EBK [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 01, 2003 4:51 PM Subject: Re: Remove ^M characters from xhtml file Hello everyone, I'm very new to BSD this mailing list so please forgive me should I post incorrectly. Here are some links that may help you with removing the ^M character from any file!! http://www.unixblog.com/quick_unix_tips/remove_m_with_vi.php - I like this one personally, because I've used it before it worked!! http://www.introcomp.co.uk/general/remove_dos.html BigDaddyEBK Unix for Longevity AS/400 for Nostalgia Linux for Productivity MAC for Multimedia Windows for Solitaire Hello tech support? I broke the cup-holder on my computer!! Date: Mon, 1 Dec 2003 23:10:33 +0530 From: Shantanoo Mahajan [EMAIL PROTECTED] Subject: Re: Remove ^M characters from xhtml file To: Robin Schoonover [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii +++ Robin Schoonover [freebsd] [30-11-03 19:17 -0700]: | On Sun, 30 Nov 2003 21:16:02 -0600, Bryan Cassidy | [EMAIL PROTECTED] | wrote: | 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? | | dos2unix (converters/unix2dos in ports) is an easy route (dos2unix | name). | Also you can use the tr command (tr -d '\r' name newname). | | -- | Robin Schoonover (aka End) col -bx old.xhtml new.xhtml Shantanoo ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Remove ^M characters from xhtml file
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? ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Sun, 30 Nov 2003 21:16:02 -0600, Bryan Cassidy [EMAIL PROTECTED] wrote: 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? dos2unix (converters/unix2dos in ports) is an easy route (dos2unix name). Also you can use the tr command (tr -d '\r' name newname). -- Robin Schoonover (aka End) # # You hear the moon howling at you. # -- NetHack ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Sun, Nov 30, 2003 at 09:16:02PM -0600, Bryan Cassidy wrote: 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? There's a port called dos2unix of unix2dos that you could let loos on it. -- Alex Articles based on solutions that I use: http://www.kruijff.org/alex/index.php?dir=docs/FreeBSD/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sorry about sending you a e-mail directly. The tr -d '/r' name newname worked perfect. Thanks. On Sun, 30 Nov 2003 19:17:46 -0700 Robin Schoonover [EMAIL PROTECTED] wrote: On Sun, 30 Nov 2003 21:16:02 -0600, Bryan Cassidy [EMAIL PROTECTED] wrote: 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? dos2unix (converters/unix2dos in ports) is an easy route (dos2unix name). Also you can use the tr command (tr -d '\r' name newname). -- Robin Schoonover (aka End) # # You hear the moon howling at you. # -- NetHack ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/yrWJm8uTTHnDH3ERAoMmAJ4wNxUHEGTzOImkD9rxR+rAsb3c9gCghBha OstE8EoA4n4FaKIa+lTp2mw= =83Sy -END PGP SIGNATURE- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I take that back. It worked on 1 file and then ir started erasing the contents of the file. On Sun, 30 Nov 2003 21:29:13 -0600 Bryan Cassidy [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sorry about sending you a e-mail directly. The tr -d '/r' name newname worked perfect. Thanks. On Sun, 30 Nov 2003 19:17:46 -0700 Robin Schoonover [EMAIL PROTECTED] wrote: On Sun, 30 Nov 2003 21:16:02 -0600, Bryan Cassidy [EMAIL PROTECTED] wrote: 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? dos2unix (converters/unix2dos in ports) is an easy route (dos2unix name). Also you can use the tr command (tr -d '\r' name newname). -- Robin Schoonover (aka End) # # You hear the moon howling at you. # -- NetHack ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/yrWJm8uTTHnDH3ERAoMmAJ4wNxUHEGTzOImkD9rxR+rAsb3c9gCghBha OstE8EoA4n4FaKIa+lTp2mw= =83Sy -END PGP SIGNATURE- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/yrf1m8uTTHnDH3ERAuZHAJ9cJmkgPKcH4M7SfFByydaH97I1JgCgoN5T o/kW51mvb28bn9tR0bZGGAg= =rTBp -END PGP SIGNATURE- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Sunday 30 November 2003 10:39 pm, Bryan Cassidy wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, I take that back. It worked on 1 file and then ir started erasing the contents of the file. perl -pi -e s:^M::g filenames Usually works for me. Picked it up from http://www.freebsddiary.org/control-m.php ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Monday 01 December 2003 04:39, Bryan Cassidy wrote: Well, I take that back. It worked on 1 file and then ir started erasing the contents of the file. On Sun, 30 Nov 2003 21:29:13 -0600 Bryan Cassidy [EMAIL PROTECTED] wrote: Sorry about sending you a e-mail directly. The tr -d '/r' name Robin Schoonover [EMAIL PROTECTED] wrote: name). Also you can use the tr command (tr -d '\r' name Spot the difference. Another way: perl -pi.bak -e 's/\r$//' *.xhtml BTW: why is this even an issue that needs a solution? XHTML doesn't care one way or the other, since all linear spacing is folded into one space. -- Melvyn === FreeBSD sarevok.webteckies.org 5.2-BETA FreeBSD 5.2-BETA #1: Sat Nov 29 00:15:33 CET 2003 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/ SAREVOK_NOFW_DBG i386 === pgp0.pgp Description: signature
Re: Remove ^M characters from xhtml file
On Nov 30, 2003, at 6:53 PM, Melvyn Sopacua wrote: Another way: perl -pi.bak -e 's/\r$//' *.xhtml BTW: why is this even an issue that needs a solution? XHTML doesn't care one way or the other, since all linear spacing is folded into one space. It's distracting to look at all that stuff if you're editing in vi, for example. But for yet one more solution, you can search and replace ^M as Control V Control M in vi. I also use perl -pi s#\\r#\\n#g filename all the time. -- Paul Beard paulbeard.no-ip.org/movabletype/ paulbeard [at] mac.com ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, why have a BUNCH of ^M characters in your file if you don't *need* them? If there is no point in having these characters I want them removed. BTW, your command worked fine. I've tried it on several files and it works just fine. Thanks. On Mon, 1 Dec 2003 03:53:00 +0100 Melvyn Sopacua [EMAIL PROTECTED] wrote: On Monday 01 December 2003 04:39, Bryan Cassidy wrote: Well, I take that back. It worked on 1 file and then ir started erasing the contents of the file. On Sun, 30 Nov 2003 21:29:13 -0600 Bryan Cassidy [EMAIL PROTECTED] wrote: Sorry about sending you a e-mail directly. The tr -d '/r' name Robin Schoonover [EMAIL PROTECTED] wrote: name). Also you can use the tr command (tr -d '\r' name Spot the difference. Another way: perl -pi.bak -e 's/\r$//' *.xhtml BTW: why is this even an issue that needs a solution? XHTML doesn't care one way or the other, since all linear spacing is folded into one space.-- Melvyn === FreeBSD sarevok.webteckies.org 5.2-BETA FreeBSD 5.2-BETA #1: Sat Nov 29 00:15:33 CET 2003 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/ SAREVOK_NOFW_DBG i386=== -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/ysX4m8uTTHnDH3ERAuv7AKCyUppGcn1gttFeGPQKRaHcMSqfMgCdFpJd T0jXqXZgUEFi5gsM0DkkgSo= =eors -END PGP SIGNATURE- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Remove ^M characters from xhtml file
On Sun, 30 Nov 2003, Bryan Cassidy wrote: 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? perl -pi -e s#\r##g filespecs If it is just one or two files it might be just as easy to search and replace \r with nothing in your text editor (depending on your text editor). -- Lars Eighner [EMAIL PROTECTED] -finger for geek code- http://www.io.com/~eighner/index.html 8800 N IH35 APT 1191 AUSTIN TX 78753-5266 ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]