You must Sign In to post a response.
  • Category: General

    How to Split a text file into multiple files using DOS

    Are you looking for a way to Split a text file into multiple files ? then read this thread to know more about it

    how to split a text file into parts based on file size using dos
  • #747406
    I don't think there is a 'SPLIT' like command exist in DOS, I have seen that command working only with Linux.
    if you want to use it on windows then you need to code it with .NET
    please clarify what you want exactly.

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #747407
    can u send the .net code

  • #747900
    check below command if it helps:
    Note you should have some filter string names against which you split files. In this case each file will begin with the string "XYZ".

    @echo off
    setlocal enabledelayedexpansion

    if "%~1"=="" echo Bad filename & exit /b
    if not exist "%~f1" echo Cannot find %~1 & exit /b

    set count=0
    for /f "tokens=1,* delims=]" %%a in ('type "%~nx1" ^| find /n /v ""') do (
    set str=%%b
    if "!str:~0,3!"=="XYZ" (
    set /a count+=1
    echo Creating file: !count!

    other case use this ABC.txt is the file name and it would be extracted from line content

    setlocal enabledelayedexpansion
    set IDX=1
    for /f "delims=<> tokens=1" %%L in (ABC.txt) do (
    echo %%L>file!IDX!.bat
    set /A IDX+=1

    please send me exact file sample and result outputs you want... will try to help you further.


  • Sign In to post your comments