RE: [PHP] Carriage return.
| From: | EMP) | Date: | Wed, 05 Sep 2001 09:48:11 +0000 |
| Subject: | RE: [PHP] Carriage return. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-66022@lists.php.net to get a copy of this message | ||
I knew that one Jon but thanks for looking it up for me.
What i need to know is if there is a way to do this without involving unix commands like
"perl" "sed" "dos2unix" etc etc.
I need to know if there is a simple way to do this with just php and not some regexp solution.
I want to know if there is a built in function of some kind that will do this.
//Johan
-----Original Message-----
From: Jon Farmer [mailto:jonfarmer@enta.net]
Sent: den 5 september 2001 11:44
To: Johan Vikerskog (EMP); php_list
Subject: Re: [PHP] Carriage return.
> My php script is generating a file that is saved in Unix format.
> I automatically get the "^M" in the end of everyline. Is there a way
> of saving this without getting the "^M" in the end of each line?
/usr/bin/perl -npe 's/\r\n/\n/g' filename
will remove the Ctrl-M characters for you. You could call it straight after
the line that generates the file.
Regards
Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07968 524175
PGP Key available, send blank email to pgpkey@bctech.co.uk