Link to home
Create AccountLog in
Avatar of maurice cristen
maurice cristen

asked on

text file problem, I have many files that end up like this

text file problem, I have many files,i chosed to split thm in 4000 lines each
i use this small batch script to split every 4000 lines:

@echo off
    setlocal enableextensions disabledelayedexpansion

    set "nLines=4000"
    set "line=0"
    for /f %%a in ('type file.txt^|find /c /v ""') do set "fileLines=%%a"

    < "file.txt" (for /l %%a in (1 1 %fileLines%) do (
        set /p "data="
        set /a "file=1+line/%nLines%", "line+=1"
        setlocal enabledelayedexpansion
        >>"pass!file!.txt" echo(!data!


Open in new window

Line 4001 is not empty look atached snapshot
Avatar of Bill Prew
Bill Prew

I ran a test here on a test file and did not see the condition you are reporting.  Perhaps it is your input file, if you want to post that here (attach), and also attach (not paste) the actual BAT file (rename to TXT so it can upload) I will look at them to see if there is anything odd about them.

Here are the files from my test.

Also, that BAT file is the hard and slow way to split a file, you might take a look at the Unix split command.  A Windows port can be obtained as part of this package:

Or with just a tiny bit of work you can grab a much more current version of these unix utils ported to windows from the portable version of GIT for Windows:

Given some of the text file manipulations you seem to do having some of these tools might come in handy...

Avatar of maurice cristen


In my laptop i opened ur .zip archive and run pass1.txt,everything seems ok when i put that file in my other pc , look snp
On my rdp not ok in my laptop ok in my pc not ok ,why? i really not understand i inspect the entire file i clean it etc everything seems ok
Avatar of Bill Prew
Bill Prew

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
IS THE SAME BAT i am 100% sure i have only this one so must be anotehr explination :P
Okay, sorry I can't be of further help.  I'll be interested in what you find as the problem.

anyway donest matter i will give you some points,plz help me with hobocopy
I see no question about "hobocopy" (or "robocopy").

Also, could you revist this question and act on it please: