From: dingdongdingding on
Unix has this split command. Can't find the windows equivalent.

On Apr 7, 12:31 am, Nil <redno...(a)REMOVETHIScomcast.net> wrote:
> On 05 Apr 2010, dingdongdingding <dingdongdingd...(a)yahoo.com> wrote in
> microsoft.public.windowsxp.general:
>
> > I'm looking for an windows command line utility that can split files
> > by number of line.  Most of them are by bytes... can anyone
> > recommend ?  Thanks.
>
> There are Windows ports of the unix head, tail, and split utilities.
> Some combination of those could probably be scripted to do what you
> want.

From: Pegasus [MVP] on
This is exactly the way I wrote it. As I said, your spec was somewhat vague
and allowed several interpretations.

"dingdongdingding" <dingdongdingding(a)yahoo.com> wrote in message
news:9cc8f67f-8704-4443-98e5-0001876ba705(a)z6g2000yqz.googlegroups.com...
> Interesting. When I tested this, I got 2 files. 1st one with first n
> lines. The 2nd one has the rest of the lines (> n lines insde).
>
> On Apr 6, 5:05 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote:
>> "dingdongdingding" <dingdongdingd...(a)yahoo.com> wrote in message
>>
>> news:85c44ac3-bb4f-4dbe-a629-c7ea09cd30c0(a)b33g2000yqc.googlegroups.com...
>>
>> > I'm looking for an windows command line utility that can split files
>> > by number of line. Most of them are by bytes... can anyone
>> > recommend ? Thanks.
>>
>> Your spec is a little vague but perhaps this batch file will ding the way
>> you want it to dong:
>> @echo off
>> set sName=d:\My Files\My Text File.txt
>> set iLines=30
>> echo.
>> if not exist "%sName%" (
>> echo File "%sName%" not found
>> goto :eof
>> )
>> set Scr="%temp%\TempVBS.vbs"
>> set VB=echo^>^>%Scr%
>> cd 1>nul 2>%Scr%
>> %VB% Set oFSO = CreateObject("Scripting.FileSystemObject")
>> %VB% Set oFile = oFSO.OpenTextFile("%sName%")
>> %VB% aFile = Split(oFile.ReadAll, VbCrLf)
>> %VB% oFile.Close
>> %VB% Set oOut1 = oFSO.CreateTextFile("%sName%" ^& ".1",True)
>> %VB% Set oOut2 = oFSO.CreateTextFile("%sName%" ^& ".2",True)
>> %VB% if %iLines% ^> ubound(aFile) then iLines = UBound(aFile)+1
>> %VB% For i = 0 To %iLines%-1
>> %VB% oOut1.WriteLine aFile(i)
>> %VB% Next
>> %VB% oOut1.Close
>> %VB% If UBound(aFile) ^>= %iLines% Then
>> %VB% For i = %iLines% To UBound(aFile)
>> %VB% oOut2.WriteLine aFile(i)
>> %VB% Next
>> %VB% End If
>> %VB% oOut2.Close
>> cscript //nologo %Scr%
>> rem del %Scr%
>> echo Data stored in "%sName%.1" and "%sName%.2"
>
From: Nil on
On 06 Apr 2010, dingdongdingding <dingdongdingding(a)yahoo.com> wrote
in microsoft.public.windowsxp.general:

> Unix has this split command. Can't find the windows equivalent.

Here's two:

http://openetwork.com/berk.html

http://www.softwareonline.org/winxs42.html

I've seen others. It often comes in a bundle with a bunch of other unix
utilities.
From: dingdongdingding on
Thanks. I think the split from http://openetwork.com/berk.html is good
for me.

Thanks everybody !

On Apr 7, 11:46 pm, Nil <redno...(a)REMOVETHIScomcast.net> wrote:
> On 06 Apr 2010, dingdongdingding <dingdongdingd...(a)yahoo.com> wrote
> in microsoft.public.windowsxp.general:
>
> > Unix has this split command.  Can't find the windows equivalent.
>
> Here's two:
>
> http://openetwork.com/berk.html
>
> http://www.softwareonline.org/winxs42.html
>
> I've seen others. It often comes in a bundle with a bunch of other unix
> utilities.