0

I have a large number of text files (2000) each of 1 mb. What I am looking to do is join them in the easiest way possible, however, contrary to the already posted methods, I don't want to append one to the bottom of the previous one, I want to append it to the right (new column, tab) of the previous one.

For example, if there are 2 text files: 1 containing a a and other containing b: I want

a        b

instead of

a
b

Thanks!

4

1 に答える 1

0

これがどのように機能するかを見てください。TAB と書かれているところにリテラルの TAB 文字を置きます。

かなり時間がかかりそうです。! ソースの文字が問題になる場合があります。

*.tmp ファイルを削除するので、ある場合はフォルダーの外に移動します。

フォルダー内の半ダースのファイルでテストできます。

@echo off
del *.tmp 2>nul
del "outputfile.txt" 2>nul
setlocal enabledelayedexpansion
for /f "delims=" %%a in (' dir *.txt /b /on ') do (
set c=0
echo processing %%a
for /f "delims=" %%b in (' type "%%a" ') do (
set /a c=c+1
>>!c!.tmp set /p "=%%bTAB"<nul
)
)
for /L %%c in (1,1,54676) do (
if not exist %%c.tmp goto :done
echo adding file %%c of 54676
for /f "delims=" %%d in (' type "%%c.tmp" ') do (
>>"outputfile.txt" echo(%%d
)
)
:done
del *.tmp 2>nul
echo done
pause
于 2013-06-06T14:07:32.727 に答える