From: dingdongdingding on
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.
From: LD55ZRA on

You could write your own or try this:

<http://www.gdgsoft.com/gsplit/>

If you tell me what you want to do, I can do it for you and send
you by email. Send me a sample file and tell me how many lines in
each file and I will do it for you. Make sure the files are text
files not binary files because lines only apply to text files.

hth


dingdongdingding wrote:
>
> 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.

--
THE INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND. LD55ZRA DISCLAIMS ALL WARRANTIES, EITHER EXPRESSED OR
IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL LD55ZRA
OR ITS ASSOCIATES BE LIABLE FOR ANY DAMAGES WHATSOEVER
INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF
BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF LD55ZRA OR ITS
ASSOCIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR
LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL
DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright LD55ZRA 2010.
From: Pegasus [MVP] on
"dingdongdingding" <dingdongdingding(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 05 Apr 2010, dingdongdingding <dingdongdingding(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: dingdongdingding on
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"