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!
        endlocal
    ))

    endlocal

Open in new window


Line 4001 is not empty look atached snapshot
EasyCapture2.jpg
Windows OS* text file

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon
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.

EE29068538.zip


»bp
Bill Prew

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
maurice cristen

ASKER
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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
maurice cristen

ASKER
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
ASKER CERTIFIED SOLUTION
Bill Prew

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
maurice cristen

ASKER
IS THE SAME BAT i am 100% sure i have only this one so must be anotehr explination :P
Bill Prew

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


»bp
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
maurice cristen

ASKER
anyway donest matter i will give you some points,plz help me with hobocopy
maurice cristen

ASKER
thx
Bill Prew

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

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



»bp
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23