Results 1 to 3 of 3
  1. #1
    aneuryzma is offline Member
    Join Date
    Aug 2008
    Posts
    46
    Rep Power
    0

    Default How to split text files with java ?

    What's best way in Java to split text files ?

    I've a 74MB text file, and I need to split it into a 50MB and 14MB files.

    I would like to specify it by percentage if possible.. i.e. 70% and 30%

    thanks

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    in text files, correct me if i'm wrong, but each character takes up 1 byte? so if you do a character count, you can get 0.7*charCount in one file and the rest in another file

  3. #3
    aneuryzma is offline Member
    Join Date
    Aug 2008
    Posts
    46
    Rep Power
    0

    Default

    Hi,

    I've solved from unix with

    split -l 189315 data/upcoming-wsdm10.txt

    I've calculated 189315 manually, as row splitting the file into 70% and 30%

Similar Threads

  1. Java encyption for text files
    By counterfox in forum New To Java
    Replies: 4
    Last Post: 02-14-2011, 03:06 AM
  2. Replies: 7
    Last Post: 04-10-2010, 12:46 PM
  3. Behaving text files like binary files
    By Farzaneh in forum New To Java
    Replies: 2
    Last Post: 08-27-2008, 04:20 PM
  4. Does OS intervene when reading Java text files
    By Tina G in forum Advanced Java
    Replies: 1
    Last Post: 04-07-2008, 03:29 PM
  5. Text and image files within jar files
    By erhart in forum Advanced Java
    Replies: 8
    Last Post: 01-19-2008, 05:43 AM

Posting Permissions

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