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

maurice cristen
maurice cristen used Ask the Experts™
on
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!
        endlocal
    ))

    endlocal

Open in new window


Line 4001 is not empty look atached snapshot
EasyCapture2.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
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.

EE29068538.zip


»bp
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
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...


»bp

Author

Commented:
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
snap2.bmp

Author

Commented:
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
Test your restores, not your backups...
Top Expert 2016
Commented:
Try copying the BAT file from the machine where it works okay (laptop) to the other machines, maybe a different there.

Other than that it's something different in the environments but I can't diagnose that.


»bp

Author

Commented:
IS THE SAME BAT i am 100% sure i have only this one so must be anotehr explination :P
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
Okay, sorry I can't be of further help.  I'll be interested in what you find as the problem.


»bp

Author

Commented:
anyway donest matter i will give you some points,plz help me with hobocopy

Author

Commented:
thx
Bill PrewTest your restores, not your backups...
Top Expert 2016

Commented:
I see no question about "hobocopy" (or "robocopy").

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



»bp

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial