DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Divide a txt file according rules  (Read 6,949 times)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Divide a txt file according rules
« on: December 28, 2012, 05:45 PM »
I would like a software to divide in several parts a txt file according rules.
By example :
A txt file with 30 lines of text divide in three files of 10 lines each one.

Best Regards
:-*

Josh

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,411
    • Gathering Badge
    • Official Forum Clown
    • Coding Snacks
    • Plugin Coding Medal
    • Volunteers/Staff
    • Military Service Badge - US Army
    • Furry Fandom Badge - Furry Fandom
    • Linux User
Re: Divide a txt file according rules
« Reply #1 on: December 28, 2012, 06:00 PM »
Is this the only rule you will need?
Strength in Knowledge

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: Divide a txt file according rules
« Reply #2 on: December 28, 2012, 07:15 PM »
For that kind of stuff, Stahlworks' Swiss File Knife has been a most excellent choice. :Thmbsup:
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Divide a txt file according rules
« Reply #3 on: December 28, 2012, 07:32 PM »
Running to try
Best Regards
;D

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Divide a txt file according rules
« Reply #4 on: December 28, 2012, 08:09 PM »
:(
How can i do that with SFK
It's a little difficult for me.
:-[

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: Divide a txt file according rules
« Reply #5 on: December 28, 2012, 08:12 PM »
Try like this: http://stahlworks.com/dev/index.php?tool=split There's an example called "splitting text files by no. of lines"
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

kunkel321

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 626
    • Participated in NANY Challenge Once
Re: Divide a txt file according rules
« Reply #6 on: December 28, 2012, 08:20 PM »
For that kind of stuff, Stahlworks' Swiss File Knife has been a most excellent choice. :Thmbsup:
This is my new favorite thing!

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Divide a txt file according rules
« Reply #7 on: December 28, 2012, 08:25 PM »
Try like this: http://stahlworks.com/dev/index.php?tool=split There's an example called "splitting text files by no. of lines"
:-*
I'll try and comment
;D

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
Re: Divide a txt file according rules
« Reply #8 on: December 29, 2012, 03:17 PM »
Take a look at the Windows ports of Gnu Coreutils.  The Split command may do what you want:

C:\$DATA\$installers\copy-into-winnt>split --help
Usage: split [OPTION] [INPUT [PREFIX]]
Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default
PREFIX is `x'.  With no INPUT, or when INPUT is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
  -a, --suffix-length=N  use suffixes of length N (default 2)
  -b, --bytes=SIZE        put SIZE bytes per output file
  -C, --line-bytes=SIZE  put at most SIZE bytes of lines per output file
  -l, --lines=NUMBER      put NUMBER lines per output file
      --verbose          print a diagnostic to standard error just
                            before each output file is opened
      --help    display this help and exit
      --version  output version information and exit

SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.

Report bugs to <bug-textutils@gnu.org>.
vi vi vi - editor of the beast

Contro

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 3,947
Re: Divide a txt file according rules
« Reply #9 on: December 30, 2012, 05:17 AM »
Try like this: http://stahlworks.com/dev/index.php?tool=split There's an example called "splitting text files by no. of lines"

Thanks a lot Ath
Happy New Year !!!!!!!!!
:P

Original address: https://www.donationcoder.com/forum/index.php?topic=33457.0