Re: Means of trimming files

From: Gerard Samuel (fbsd-questions_at_trini0.org)
Date: 06/29/04

  • Next message: Kent Stewart: "Re: REPOST: Performance problems with FTP"
    To: freebsd-questions@freebsd.org
    Date: Tue, 29 Jun 2004 16:46:28 -0400
    
    

    On Tuesday 29 June 2004 04:21 pm, Gerard Samuel wrote:
    > So Ill start using truncate() for now, and start investigating perl.
    > Thanks....
    >

    As I was writing the previous email, I thought about combining find with php's
    cli interface and came up with this "dirty" command (all in one line) ->

    find ./ -name '*.php' -exec php -r '$f = file_get_contents("{}"); $h =
    fopen("{}", "wb"); fwrite($h, trim($f)); fclose($h);' \;

    It did the job perfectly.
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Kent Stewart: "Re: REPOST: Performance problems with FTP"

    Relevant Pages

    • Re: Means of trimming files
      ... >> So Ill start using truncate() for now, and start investigating perl. ... > As I was writing the previous email, I thought about combining find with php's ...
      (freebsd-questions)
    • Re: My future is in tatters.... :(
      ... I didn't like to say in case it upset the original poster, so, if you're reading, here's some spoiler space ... and a C for general studies. ... drawing graphs instead of writing, he got a C. Unfair, isn't it? ... been very anti-paperwork and forms since being ill, ...
      (uk.people.support.depression)
    • Re: J2ME Open file for writing
      ... Darko wrote ... At the moment I'm using the API that hasn't got FileConnection class, ... What I would like is the "truncate" behaviour, ... meaning the file should be truncated the moment it's open for writing. ...
      (comp.lang.java.programmer)
    • Re: Word processors for Mac - the verdict
      ... except for wittering on in writing. ... Too ill. ...
      (uk.comp.sys.mac)
    • Re: Logrotate is a pain
      ... refered to by its inode not a name. ... the file when it is finished writing, or will respond to a signal ... >to have missed is that if you rename an open log file, ... >when the copy is complete and the return code is checked, simply truncate ...
      (comp.os.linux.misc)