Re: Remove trailing blank lines at the end of a file



Luk wrote:
On 30 Mar, 21:56, Iván Sánchez Ortega <ivansanchez-...@rroba-
escomposlinux.-.punto.-.org> wrote:
Luk wrote:
I used trim. But without results. Other hints?
$userfile holds the *contents* and not the *name* of the file, right?
Right??

You are writing the trimmed stuff back to the file, right?

Yes, should be. This is the code used:

if (move_uploaded_file($_FILES['uploaded_file']['tmp_name'],
$userfile)) {
echo 'OK';
}

then after the checks about the spaces and other chars, there's the
foreach cicle that works:

$lines = file($userfile);
foreach ($lines as $line_num => $line) {
//stuff
}

Luk

What is in the //stuff?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: Remove trailing blank lines at the end of a file
    ... You are writing the trimmed stuff back to the file, ... echo 'OK'; ... then after the checks about the spaces and other chars, ... foreach cicle that works: ...
    (comp.lang.php)
  • Re: perl open function for size bigger than 2 Gig
    ... I still have trouble with writing a big file. ... want to check whether the open command succeeded, ... Does it work when you specify a filename that doesn't exist, ... > figure out why echo doesn't work or any other program to try. ...
    (comp.lang.perl.misc)
  • Re: sh Solaris problem
    ... Doing an echo "ESCAPE+P" in a sh, ... I tried to echo those 2 chars via octal rapresentation, ...
    (comp.unix.solaris)
  • Re: Using a string as a hash (symbolic ref)
    ... SB> programs) writing the tests than I do when I'm writing the programs ... coding is coding and the more you do the more you learn. ... just a plain string with / chars on the ends. ... the unlike call will convert that but the / will be literal / chars. ...
    (perl.beginners)
  • Re: Replacing whitespace, using bash script and sed
    ... > I'm writing a script to start an application, ... > echo Got $BASEDIR ...
    (comp.sys.mac.programmer.help)