Re: control characters and other entities

2002-04-17 Thread Grzegorz Czaplinski

Jon, just try this:
$ cat file.txt | tr -d "\015" > file.txt
to remove ^M at the end of lines.
Regards,
gregory

On Wed, Apr 17, 2002 at 04:07:58PM +0100, Jon Howe wrote:
> I am currently ripping apart some text files on my linux box that where created on 
>windows
> 
> I am having a problem with things like  ^M appearing where I would expect \n and ~S 
>where there should be a  '  .
> I can remove ^M with :
> 
> s/\cM\n/\n/g;   
> 
> I assume this is some sort of char encoding problem can some advise on the best way 
>to deal with this.
> 
-- 
Grzegorz Czaplinski <[EMAIL PROTECTED]>
"The Power to Serve, Right for the Power Users!" - http://www.FreeBSD.org/
 Fingerprint: EB77 E19D CFA2 5736 810F  847C A70F A275 2489 469F



msg22352/pgp0.pgp
Description: PGP signature


RE: control characters and other entities

2002-04-17 Thread Jaimee Spencer

Hello Timothy,

If you wanted to do it the perl way, which can be more then one way.
Type in the below code.

#!/usr/bin/perl -i
while (<>) {
/\n/g;;
print $_;
}

Regards,
Jaimee

p.s Yes there is a utility called dos2unix you use it in perl also by typing

$cformat = `dos2unix $filename $filename`;

or use it as a standalone at the command line by typing
dos2unix inputfile outputfile

-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 1:56 PM
To: 'John W. Krahn'; [EMAIL PROTECTED]
Subject: RE: control characters and other entities



Isn't there a utility called dos2unix or something like that that comes with
linux?

-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: Re: control characters and other entities


Jon Howe wrote:
> 
> I am currently ripping apart some text files on my
> linux box that where created on windows
> 
> I am having a problem with things like  ^M appearing
> where I would expect \n and ~S where there should be a  '  .
> I can remove ^M with :
> 
> s/\cM\n/\n/g;
> 
> I assume this is some sort of char encoding problem
> can some advise on the best way to deal with this.

Have a look at this program:

http://www.fourmilab.ch/webtools/demoroniser/


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: control characters and other entities

2002-04-17 Thread Timothy Johnson


Isn't there a utility called dos2unix or something like that that comes with
linux?

-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: Re: control characters and other entities


Jon Howe wrote:
> 
> I am currently ripping apart some text files on my
> linux box that where created on windows
> 
> I am having a problem with things like  ^M appearing
> where I would expect \n and ~S where there should be a  '  .
> I can remove ^M with :
> 
> s/\cM\n/\n/g;
> 
> I assume this is some sort of char encoding problem
> can some advise on the best way to deal with this.

Have a look at this program:

http://www.fourmilab.ch/webtools/demoroniser/


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: control characters and other entities

2002-04-17 Thread John W. Krahn

Jon Howe wrote:
> 
> I am currently ripping apart some text files on my
> linux box that where created on windows
> 
> I am having a problem with things like  ^M appearing
> where I would expect \n and ~S where there should be a  '  .
> I can remove ^M with :
> 
> s/\cM\n/\n/g;
> 
> I assume this is some sort of char encoding problem
> can some advise on the best way to deal with this.

Have a look at this program:

http://www.fourmilab.ch/webtools/demoroniser/


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: control characters and other entities

2002-04-17 Thread Felix Geerinckx

on Wed, 17 Apr 2002 15:07:58 GMT, Jon Howe wrote:

> I assume this is some sort of char encoding problem can some advise
> on the best way to deal with this. 

The newline sequence "\n" is encoded differently on Unix and DOS.
See



for conversion programs (in Perl).

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]