Re: [PHP] Remove blank lines from a file

2010-05-24 Thread tedd
At 2:39 PM -0400 5/24/10, Robert Cummings wrote: -snip- It highlighting the conceptual differences between different people in the production chain and how the client pretty mich didn't get what he wanted :) Cheers, Rob. Rob: Any guy called "pretty mich" probably doesn't get what he wants a

Re: [PHP] Remove blank lines from a file

2010-05-24 Thread Robert Cummings
tedd wrote: At 2:48 PM -0400 5/23/10, Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $input_text); $output_text = impl

Re: [PHP] Remove blank lines from a file

2010-05-24 Thread tedd
At 2:48 PM -0400 5/23/10, Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $input_text); $output_text = implode("\n",$tex

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Robert Cummings
Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Yes it was client stripping out extra whitespace! thanks Rob, replicated your results: 1 2 3 4 5 6 and then 'fixed' to give what's needed: preg_replace( "/(((\r|)\n)(\h*|))+/im", '\\1' , $input ); the above keeps line ter

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Nathan Rixham
Robert Cummings wrote: Nathan Rixham wrote: Yes it was client stripping out extra whitespace! thanks Rob, replicated your results: 1 2 3 4 5 6 and then 'fixed' to give what's needed: preg_replace( "/(((\r|)\n)(\h*|))+/im", '\\1' , $input ); the above keeps line termination the same as i

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Robert Cummings
Nathan Rixham wrote: Yes it was client stripping out extra whitespace! thanks Rob, replicated your results: 1 2 3 4 5 6 and then 'fixed' to give what's needed: preg_replace( "/(((\r|)\n)(\h*|))+/im", '\\1' , $input ); the above keeps line termination the same as in the source file; can y

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Nathan Rixham
Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: You may want to start testing your solutions. None have worked yet. Not even close :) filed under 'works for me' Doesn't appear to work on the following: $input = ' 1 2 3 4 5 6'; Additionally, your solution modifies li

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Robert Cummings
Nathan Rixham wrote: Robert Cummings wrote: You may want to start testing your solutions. None have worked yet. Not even close :) filed under 'works for me' Doesn't appear to work on the following: $input = ' 1 2 3 4 5 6'; Additionally, your solution modifies lines that weren't asked t

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Nathan Rixham
Robert Cummings wrote: Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_arra

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Robert Cummings
Nathan Rixham wrote: Robert Cummings wrote: Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Nathan Rixham
Robert Cummings wrote: Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $in

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Robert Cummings
Nathan Rixham wrote: Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $input_text); $output_text

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Nathan Rixham
Nathan Rixham wrote: Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $input_text); $output_text = implode("\n",$text_a

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Nathan Rixham
Robert Cummings wrote: tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $input_text); $output_text = implode("\n",$text_array); Sorry tedd, this

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread Robert Cummings
tedd wrote: At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $input_text); $output_text = implode("\n",$text_array); Sorry tedd, this is broken. It doesn't s

Re: [PHP] Remove blank lines from a file

2010-05-23 Thread tedd
At 1:02 PM -0400 5/22/10, Robert Cummings wrote: tedd wrote: If that is all (i.e., removing double linefeeds), then this will do it: $text_array = array(); $text_array = explode("\n\n", $input_text); $output_text = implode("\n",$text_array); Sorry tedd, this is broken. It doesn't solve probl

Re: [PHP] Remove blank lines from a file

2010-05-22 Thread Robert Cummings
Al wrote: On 5/22/2010 4:34 PM, Robert Cummings wrote: Al wrote: On 5/22/2010 1:02 PM, Robert Cummings wrote: tedd wrote: At 4:27 PM +0200 5/21/10, Anton Heuschen wrote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file

Re: [PHP] Remove blank lines from a file

2010-05-22 Thread Al
On 5/22/2010 4:34 PM, Robert Cummings wrote: Al wrote: On 5/22/2010 1:02 PM, Robert Cummings wrote: tedd wrote: At 4:27 PM +0200 5/21/10, Anton Heuschen wrote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved

Re: [PHP] Remove blank lines from a file

2010-05-22 Thread Robert Cummings
Al wrote: On 5/22/2010 1:02 PM, Robert Cummings wrote: tedd wrote: At 4:27 PM +0200 5/21/10, Anton Heuschen wrote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved to the server it must look like 1 2 3 4 5 6 I

Re: [PHP] Remove blank lines from a file

2010-05-22 Thread Al
On 5/22/2010 1:02 PM, Robert Cummings wrote: tedd wrote: At 4:27 PM +0200 5/21/10, Anton Heuschen wrote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved to the server it must look like 1 2 3 4 5 6 If that is

Re: [PHP] Remove blank lines from a file

2010-05-22 Thread Robert Cummings
tedd wrote: At 4:27 PM +0200 5/21/10, Anton Heuschen wrote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved to the server it must look like 1 2 3 4 5 6 If that is all (i.e., removing double linefeeds), then thi

Re: [PHP] Remove blank lines from a file

2010-05-22 Thread tedd
At 4:27 PM +0200 5/21/10, Anton Heuschen wrote: So in the file it would look like (from the original file the user uploads that is) 1 2 3 4 5 6 but when the file is saved to the server it must look like 1 2 3 4 5 6 If that is all (i.e., removing double linefeeds), then this will do it:

Re: [PHP] Remove blank lines from a file

2010-05-21 Thread Gary
Anton Heuschen writes: > Hi Im trying do something like this, have a function which uploads my > file and returns file pointer ... but at same time ... I want to > remove all Blank lines in a file and update it sed -i '/^$/d' yourFile -- Gary -- PHP General Mailing List (http://www.php.net/)

RE: [PHP] Remove blank lines from a file

2010-05-21 Thread Bob McConnell
From: Anton Heuschen > On 21 May 2010 15:16, Ashley Sheridan wrote: >> On Fri, 2010-05-21 at 14:03 +0200, Anton Heuschen wrote: >> >> Hi Im trying do something like this, have a function which uploads my >> file and returns file pointer ... but at same time ... I want to >> remove all Blank line

Re: [PHP] Remove blank lines from a file

2010-05-21 Thread Anton Heuschen
On 21 May 2010 15:16, Ashley Sheridan wrote: > On Fri, 2010-05-21 at 14:03 +0200, Anton Heuschen wrote: > > Hi Im trying do something like this, have a function which uploads my > file and returns file pointer ... but at same time ... I want to > remove all Blank lines in a file and update it be

Re: [PHP] Remove blank lines from a file

2010-05-21 Thread Ashley Sheridan
On Fri, 2010-05-21 at 14:03 +0200, Anton Heuschen wrote: > Hi Im trying do something like this, have a function which uploads my > file and returns file pointer ... but at same time ... I want to > remove all Blank lines in a file and update it before it goes to the > final location ... > > What

[PHP] Remove blank lines from a file

2010-05-21 Thread Anton Heuschen
Hi Im trying do something like this, have a function which uploads my file and returns file pointer ... but at same time ... I want to remove all Blank lines in a file and update it before it goes to the final location ... What I tried was to do a write of file and use some regexp replace to remov