yc2
May 10th, 2009, 01:29 PM
I usually keep an Ubuntu server, but my webpage temporarily resides on GoDaddy hosting.
I use sed through php. The files that come out do not get new lines under Windows.
I can make sed recognize new lines and exchanged them for html (<br>) but how do I put real new-line-characters into the file?
I have seen the following advice but I am not sure how to apply it under php. I get the quotes wrong somehow.
sed "s/$/`echo -e \\\r`/" # command line under ksh
sed 's/$'"/`echo \\\r`/" # command line under bash
sed "s/$/`echo \\\r`/" # command line under zsh
sed 's/$/\r/' # gsed 3.02.80
Please give me back my good night's sleep ;) and tell me how to change this line to give a text-file with new lines readable under Windows.
<?php
$output = shell_exec('sed -e \'s/$/<br>/\' in.txt');
echo $output;
?>
I use sed through php. The files that come out do not get new lines under Windows.
I can make sed recognize new lines and exchanged them for html (<br>) but how do I put real new-line-characters into the file?
I have seen the following advice but I am not sure how to apply it under php. I get the quotes wrong somehow.
sed "s/$/`echo -e \\\r`/" # command line under ksh
sed 's/$'"/`echo \\\r`/" # command line under bash
sed "s/$/`echo \\\r`/" # command line under zsh
sed 's/$/\r/' # gsed 3.02.80
Please give me back my good night's sleep ;) and tell me how to change this line to give a text-file with new lines readable under Windows.
<?php
$output = shell_exec('sed -e \'s/$/<br>/\' in.txt');
echo $output;
?>