topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Saturday December 14, 2024, 2:54 pm
  • 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

Last post Author Topic: DONE: Split .txts into smaller ones when there is a space line  (Read 42020 times)

alogoc

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 19
    • View Profile
    • Donate to Member
Hello donation coders

I am looking for a program that will split .txts into smaller ones.
Now how to know how to split?
Well it will now by the space line.The only thing i want is not to move the spaced line into the created .txts


I am a bit in a hurry for this,so anyone how can make it for me will really appreciated and donated  :)

Waiting for your answers,please don't hesitate to ask for more information if you need

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #1 on: August 27, 2009, 06:07 AM »
Given a text file like this:

Lorem ipsum dolor sit amet consectetuer tincidunt adipiscing.
Aenean eget Vestibulum metus Sed Donec nibh.

Interdum id pellentesque Integer sodales.
Tincidunt vel Nulla porttitor Sed convallis cursus.
Mauris Vestibulum nec justo consequat leo quis libero ornare.
Accumsan Aliquam lorem feugiat at tincidunt.

Interdum Vestibulum.
Parturient.
Tellus.

You want three new text files created like this:

Text file #1:
Lorem ipsum dolor sit amet consectetuer tincidunt adipiscing.
Aenean eget Vestibulum metus Sed Donec nibh.

Text file #2:
Interdum id pellentesque Integer sodales.
Tincidunt vel Nulla porttitor Sed convallis cursus.
Mauris Vestibulum nec justo consequat leo quis libero ornare.
Accumsan Aliquam lorem feugiat at tincidunt.

Text file #3:
Interdum Vestibulum.
Parturient.
Tellus.

Is this correct?

alogoc

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 19
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #2 on: August 27, 2009, 06:12 AM »
Yes my friend,and don't worry about the naming,i have a rename tool  :)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #3 on: August 27, 2009, 06:52 AM »
Successive blank lines are to be considered as one, correct?

alogoc

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 19
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #4 on: August 27, 2009, 07:23 AM »
What do you mean by considered as one? :tellme:

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #5 on: August 27, 2009, 08:15 AM »
Give this a shot (source/binary included):  http://skwire.dcmemb...Newline_Splitter.zip

2009-08-27_081834.png

« Last Edit: August 27, 2009, 08:20 AM by skwire »

alogoc

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 19
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #6 on: August 27, 2009, 08:46 AM »
Hey!!Works perfectly!Thanks a lot!:)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #7 on: August 27, 2009, 08:58 AM »
You're welcome.  Great to hear.  =]

pulphero

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 24
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #8 on: September 27, 2009, 05:12 PM »
Would it be hard to modify this script so the user can specify the 'split target'?

For example, rather than split at blank lines, have it split at every instance of '=========='. I could then insert that string into the main text file wherever I want it to split, such as at the beginning of a section, a chapter, etc. Thanks!

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #9 on: September 27, 2009, 05:19 PM »
Could you extend it to handle this case:

https://www.donation....msg170283#msg170283

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #10 on: September 28, 2009, 06:21 AM »
Would it be hard to modify this script so the user can specify the 'split target'?

For example, rather than split at blank lines, have it split at every instance of '=========='. I could then insert that string into the main text file wherever I want it to split, such as at the beginning of a section, a chapter, etc. Thanks!

I have this almost done.  As usual, I'm struggling to come up with a name for it.  At this point, I have "Text File Cracker."   ;D  Can any of you all think of anything better?  <looks squarely at cranioscopical>

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #11 on: September 28, 2009, 06:24 AM »
Could you extend it to handle this case:

https://www.donation....msg170283#msg170283

I think your requirements might be a bit out of scope for a simple text file cracker like this.  That being said, I promise to take a deeper look at your request.

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #12 on: September 28, 2009, 07:04 AM »
I have this almost done.  As usual, I'm struggling to come up with a name for it.  At this point, I have "Text File Cracker."   ;D  Can any of you all think of anything better?  <looks squarely at cranioscopical>
No pressure,  eh?  :)

Chopping List?
Subtext?
Textarian?
ReTextChewer?
Lickety-split?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #13 on: September 28, 2009, 07:18 AM »
Hahaha...I like "Chopping List" and I have the perfect icon for it:

http://www.iconarchi...an/Hatchet-icon.html

Winner!  Winner!  Chicken dinner!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #14 on: September 28, 2009, 08:35 AM »
v1.0.1 - 2009-09-28
    + Added ability to specify a custom delimiter to split on.  (Thanks, pulphero)
    * Changed application name to "Chopping List."  (Thanks, cranioscopical)

Website | Download

main.pngDONE: Split .txts into smaller ones when there is a space line

I've done only minimal testing so feedback is required.  There will be a quiz in the morning.   :D

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #15 on: September 28, 2009, 09:03 AM »
Hahaha...I like "Chopping List" and I have the perfect icon for it:

http://www.iconarchi...an/Hatchet-icon.html

Winner!  Winner!  Chicken dinner!
Then you might like Text TriceChopper  :)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #16 on: September 28, 2009, 09:13 AM »
Chopping List with the hatchet icon is just too perfect.   8)

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
Re: Split .txts into smaller ones when there is a space line
« Reply #17 on: September 28, 2009, 09:58 AM »
I think your requirements might be a bit out of scope for a simple text file cracker like this.  That being said, I promise to take a deeper look at your request.

I appreciate that. How I envision using the Tag and Split function is

1 Creating a list of tags text file.
2 Adding the tags in front of paragraphs - like \a \b \c - just boom boom boom - that perhaps get substituted to [Topic A] [Topic B] [Topic C].
3 Running Chopping List and getting as many files as there are tags.
4 Continuing editing with all the topics neatly in their own files.

Useful for organizing any kind of text where various topics/ideas have been collected in one file. Certainly n times more efficient and quicker than cut-pasting between text files, which lacks the boom boom boomness that I'm looking for here.

There's a feature for sorting paragraphs in Word, but it fails when there is more than one paragraph before the next tag.

The best software has the least steps between beginning and achieving the goal, ideally: Boom, you're done. And after that the process should be automated if possible so you never have to repeat even that single boom*.

(*meme courtesy of Steve 'Boom' Jobs)
« Last Edit: September 28, 2009, 10:17 AM by tmpusr »

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 554
    • View Profile
    • Donate to Member
Re: DONE: Split .txts into smaller ones when there is a space line
« Reply #18 on: March 06, 2012, 08:07 PM »
Enhancement Request:

When creating the text files from a block of copied text (say from your ClipTrap) please give the option of including x number of padded zeros in front of numbers.

For instance:

Pad to three digits....

001
002
003
.
.
017
018

Thank you for a super program!

Nicholas


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: DONE: Split .txts into smaller ones when there is a space line
« Reply #19 on: March 06, 2012, 08:40 PM »
I think that is outside the scope of the application.  However, you may be able to leverage my List Numberer program to do what you want.

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 554
    • View Profile
    • Donate to Member
Re: DONE: Split .txts into smaller ones when there is a space line
« Reply #20 on: March 07, 2012, 05:21 PM »
But, but, but....

Automatically adding those padded zeros ahead of numbers would make things a bit easier.

Pretty please???


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: DONE: Split .txts into smaller ones when there is a space line
« Reply #21 on: March 07, 2012, 11:11 PM »
Doh, I went back and re-read your request and now I understand what you were asking for.  Sorry about that.   :-[  Here you go:

Website | Download
v1.0.3 - 2012-03-07
    + Option to specify number of leading zeros to pad filenames with. (Thanks, nkormanik)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 554
    • View Profile
    • Donate to Member
Re: DONE: Split .txts into smaller ones when there is a space line
« Reply #22 on: March 10, 2012, 04:51 PM »
Fantastic, Skwire, that cuts out a step in the process -- using a third-party software renamer to add in the zero-padding.

Well done!


H;o)lli

  • Participant
  • Joined in 2018
  • *
  • Posts: 2
    • View Profile
    • Donate to Member
Re: DONE: Split .txts into smaller ones when there is a space line
« Reply #23 on: April 11, 2018, 05:47 AM »
Hi Skwire,

thx for your little app!
It's the only free one I've found splitting files at a certain string and remembering the latest program parameters.

Though it's long since the latest posting here I'd like to ask for two other little features that certainly would come in handy...

- Would it be possible for you to make ChoppingList be aware of passing parameters?
  One parameter would already be enough to make my day, namely passing over a list of file names (e.g. within the destination folder) like "filenamefirst.txt filenamesecond.txt". This way, it could be used by automated scripts.
- It would be fine also if not only .txt files were accepted but also e.g. .md or .rst files (markdown and reST files surely are text files!).

Anyway, thx for your work!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: DONE: Split .txts into smaller ones when there is a space line
« Reply #24 on: April 16, 2018, 03:43 PM »
Hi, H;o)lli, and welcome to the DonationCoder site.  Apologies for the lateness of this reply; my work/business travel has been rather busy lately.

- Would it be possible for you to make ChoppingList be aware of passing parameters?

Yes, this is doable.

One parameter would already be enough to make my day, namely passing over a list of file names (e.g. within the destination folder) like "filenamefirst.txt filenamesecond.txt". This way, it could be used by automated scripts.

The only caveat is that there is a finite amount of text that you can pass on the commandline like that so you will have experiment a bit and see what you can get away with.

- It would be fine also if not only .txt files were accepted but also e.g. .md or .rst files (markdown and reST files surely are text files!).

Yes, I can do this as well.  As you've already mentioned, the app will only be able to handle text-based files, i.e., no Word docs, etc.  I will try to get to this next week as I don't travel but, if I don't have anything by next weekend, feel free to remind me in this thread.  Cheers.