topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:18 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: SOLVED: Txt Split & Sort  (Read 6085 times)

nagelfar

  • Participant
  • Joined in 2011
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
SOLVED: Txt Split & Sort
« on: October 03, 2011, 03:09 AM »
Hello,

What I am thinking about is a program which could split single txt files or all txt files in a given directory into smaller chunks. One would be able to set the size or number of the chunks. Such sliced portions would also be text files, with consecutive 001, 002, 003 etc numbering added to the file name (before the .txt extension).
What is also important is that the program should recognize text encoding correctly and retained it in the output chunks.

The chopped text files should be saved to individual folders which would be created automatically and named after each processed txt file.
I mean something like this:
> content of Input Folder = TextfileA.txt, TextfileB.txt, TextfileC.txt
> content of Output Folder =
   - sub-folder TextfileA = TextfileA001.txt, TextfileA002.txt, TextfileA003.txt ...
   - sub-folder TextfileB = TextfileB001.txt, TextfileB002.txt, TextfileB003.txt ...
   - sub-folder TextfileC = TextfileC001.txt, TextfileC002.txt, TextfileC003.txt ...  

The program could function as a standalone application, but also as a command line version (with a possibility to append it to the right-click menu) which would surely enhance its functionality.

I know some free programs which can do the splitting pretty well, like TextSplit on sourceforge.net (yields very good results and allows selection of text encoding, but has no console version, processes one file at a time only, and its settings cannot be saved) or TextFileSplitter by SystemWidgets (can split multiple files in a directory, but has problems with the correct encoding of the resultant chunks).
So, what I'd be grateful for is a program which could do the text splitting the right way and would also save me trouble renaming and sorting the output files.

I hope this is a feasible task and I am looking forward to hearing from you, ingenious minds.

Best regards,
nagelfar
« Last Edit: October 03, 2011, 06:23 AM by nagelfar »

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: SOLVED: Txt Split & Sort
« Reply #1 on: October 03, 2011, 02:32 PM »
The best (for me) file chunker I've ever seen is a 1988 DOS program, CHOP by Walter Kennamer.  It had the most intelligent way of putting the breaks in the right place for what I wanted at the time.  An alternative would be a port of Unix csplit, which you can find in more up-to-date compilations.  The way it splits may or may not suit you.  Neither will make directories as you require, but you could do that with batch files, perhaps augmented by utilities.

Details here:
  • CHOP31 (Free Software for DOS Web site)
  • CSPLIT (contained in UnxUtils Windows port)

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: SOLVED: Txt Split & Sort
« Reply #2 on: October 03, 2011, 02:50 PM »
And next to what rjbull suggests, there's also GSplit 3, that has a UI but can also be controlled from the command-line.

I've been using that to split huge logfiles into manageable pieces, and repeatedly split long lists (4000+) of usernames into the portions needed (250) for a testing tool.

nagelfar

  • Participant
  • Joined in 2011
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: SOLVED: Txt Split & Sort
« Reply #3 on: October 04, 2011, 04:06 AM »
Thank you very much for the suggestions.

I've checked the programs you mentioned and must say that GSplit satisfies my needs perfectly.
It can split files by size or by quantity of chunks, you can define the format of the output file names, and all such fine-tuned settings can be saved in a profile.
It doesn't lose text coding during the process, so the outcome text can be read without problems with displayed fonts. And it can chop multiple files, putting the pieces into individual sub-folders it creates using the names of the split files  :)
GSplit can also work from the command line, so using the functionality of FileMenu Tools (a free editor and configurator of the right-click menu) I can really achieve my aims.

Thanks a lot for your inspiring hints !
Best regards,
nagelfar