Results 1 to 3 of 3
  1. #1
    Marius is offline Member
    Join Date
    Nov 2008
    Rep Power

    Default How to remove 2 last lines in a text file?

    Can anyone give me a code to remove 2 last lines from a text file?
    I'm very new to java, and can almost only make a HelloWorld application.

    My text file looks like this:

    Java Code:
    this is line 1
    and this is the 2nd
    here comes nr 3
    and the 4th is jumping
    up and down like nr 5
    but the 6th is dead
    How can I delete the 2 last lines there?


  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

  3. #3
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Rep Power

    Default just like it was stated in the other forum...

    No can do.
    • Do not post the same question on different forums or sections of forum. It pisses people off.
    • Show some effort. The forum will try to help you if you post your code and have specific questions/doubts.

    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

Similar Threads

  1. how can we remove blank lines from a .txt
    By Camden in forum New To Java
    Replies: 12
    Last Post: 07-29-2011, 01:38 PM
  2. [SOLVED] Writing ArrayList to Text File on seperate Lines
    By shinjitsunohana in forum New To Java
    Replies: 9
    Last Post: 08-27-2008, 05:53 PM
  3. Adding lines at start and end of the text file
    By phani532 in forum New To Java
    Replies: 5
    Last Post: 08-27-2008, 03:12 PM
  4. Remove duplicate lines from a text file
    By Dirt.Diver in forum New To Java
    Replies: 15
    Last Post: 06-25-2008, 02:08 PM
  5. how to remove whitespaces in a text
    By christina in forum New To Java
    Replies: 2
    Last Post: 08-03-2007, 05:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts