FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Re: DOS newlines (CR/LF) to Unix format
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: DOS newlines (CR/LF) to Unix format [message #171741 is a reply to message #171732] Thu, 20 January 2011 03:15 Go to previous messageGo to previous message
Bjarne Jensen is currently offline  Bjarne Jensen
Messages: 9
Registered: January 2011
Karma:
Junior Member
On 2011-01-19 12:25, Luuk wrote:
> On 19-01-11 11:59, Bjarne Jensen wrote:
>> I found this snippet on internet:
>>
>> # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
>> awk '{sub(/\r$/,"");print}' # assumes EACH line ends with Ctrl-M
>>
>> It works fine on the commandline so I wrote like this in a php-script:
>>
>> - - -
>>
>> $unix = ".unix";
>>
>> foreach (glob($usedir."[12_]*") as $filename) {
>> exec('awk { sub("/\r$", ""); print } $filename> $filename.$unix');
>
> the single quotes around your AWK-script are missing...

Now corrected bot still no joy.


>> }
>>
>> - - -
>>
>>
>> But absolutely nothing happens!
>
> there might be an error on your log..

error_log now activated



>
>>
>> Why not?
>>
>>
>> /Bjarne
>
> you also could try 'dos2unix'

also no joy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: fatal error: cannot redeclare
Next Topic: getting file from <option>
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 02:02:38 GMT 2024

Total time taken to generate the page: 0.05232 seconds