#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    427
    Rep Power
    19

    (This is a Java question, not Perl.) How do I clear text out of a text file?


    I don't care if it's a single word, or several paragraphs.

    If it's in there, erase it.

    How do I do this? What's the statement(s)?
    Last edited by Frank20; July 8th, 2007 at 04:21 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    98
    Rep Power
    55
    You should get familiar with the java api, in your case the api for the File class.
    "Always be wary of the Software Engineer who carries a screw driver."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    427
    Rep Power
    19
    You're right. Thank you.
  6. #4
  7. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    113
    or just use the shell:

    % echo "">filename

    will do it.


    christo

    Comments on this post

    • Yawmark agrees
    This is me: http://chris.uk.com
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    427
    Rep Power
    19
    Thanks christo.

IMN logo majestic logo threadwatch logo seochat tools logo