Re: what is ^M at the end of a line?

[email protected] ("Rob Coops")
Newsgroups perl.beginners
Message-ID <[email protected]>
That ^M is a line feed, or well the windows version of a line feed.

There are several different ways in which to write a line feed and of course
to make our lives better *nix, Dos/Windows and Mac all have their own way of
writting them.

So Jeff's suggestion relies on a little application that simply finds ad
relapces all the dos/windows ways of doing things like line feeds and
replaces them with the unix version of the same.

If you feel like doing this in perl a simple regex will do the trick, at
least for the line feeds, but there is more windows fun to be had, like the
way MS Word replaces ceretain characters like " ' - and even ... with a
special charatcer because they are estetacly more pleasing to the reader of
the document. I am sure there are more examples and dos2unix covers them
all.

So if it is a single file and only a one of then dos2unix is the easiest
way, if you want to do it in perl then you will most likely have to use a
regex because not all moachines will have the dos2unix applicaiton
available.

Regards,

Rob Coops

On Wed, May 21, 2008 at 10:45 AM, Remy Guo <[email protected]> wrote:

> hi all,
> i have a text processing script that can work with a file but cannot work
> with another file that has the same content.
> as i compared the 2 files, i found the file that cannot work has a "^M" at
> the end of each line. what is this? is this what made it not work?
> by the way, i'm under unix.
> thanks....
>
> -Remy
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.