![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-04 07:54 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Very Large Text File |
| Printable Version 891 / 7 |
| Floor1 hrduan268 | Posted 2007-04-24 03:46 |
| 初级用户 Posts 27 Credits 72 | |
|
I have several .txt text files here, and each one is very large, about 108MB. When I changed its extension to .xls, it actually told me it couldn't be fully loaded, because it exceeded 65,536 lines; when I changed it to .doc, it was even more outrageous — it actually showed more than 30,000 pages, and also said it exceeded Word's maximum page count!
Under DOS, is there any way to split one .txt into several .txt files? [ Last edited by hrduan268 on 2007-4-24 at 08:15 AM ] |
|
| Floor2 hrduan268 | Posted 2007-04-24 09:24 |
| 初级用户 Posts 27 Credits 72 | |
|
http://www.cn-dos.net/forum/viewthread.php?tid=26345###
So someone had already done this before. I'll go back and try it first, then study it some more. |
|
| Floor3 bjsh | Posted 2007-04-24 09:50 |
| 银牌会员 Posts 621 Credits 2,000 | |
|
Actually, many of the questions being asked now;
had already been solved before and can all be found by searching; |
|
| Floor4 hrduan268 | Posted 2007-04-24 10:48 |
| 初级用户 Posts 27 Credits 72 | |
|
I used 9527's program, but it didn't work:
@echo off&setlocal for /f "tokens=1*" %%a in (fi.txt) do call :pp "%%a" "%%b" goto :eof :pp if /i %1 equ "**BEGIN" ( >>%~2.txt echo %~1 %~2&set a=%~2.txt ) else ( >>%a% echo %~1 %~2 ) goto :eof Maybe it isn't suitable for extra-long text files |
|
| Floor5 hrduan268 | Posted 2007-04-24 11:00 |
| 初级用户 Posts 27 Credits 72 | |
|
Using 无奈何's program, it works:
@echo off setlocal ENABLEDELAYEDEXPANSION for /f "delims=" %%i in (spil.txt) do ( set tmp=%%i if "!tmp:~0,7!" == "**BEGIN" ( set file=!tmp:*BEGIN =! echo %%i>!file! ) else ( echo %%i>>!file! ) ) I inserted things like **BEGIN FILE1 **END from the original text into the text file, and in total it needs to be split into 3 text files. But after running for more than 30 minutes, the first text file to be split still wasn't finished (that is, the first END still hadn't appeared), so I stopped it. Then I changed this unfinished first text file to XLS, and it still said the line count was too large and it couldn't be fully loaded. Looks like it has to be split into 40 text files, but manually adding **BEGIN FILE1 **END and so on is really troublesome. Just opening that 108MB text file alone takes several minutes. Is there any way!! [ Last edited by hrduan268 on 2007-4-24 at 08:18 AM ] |
|
| Floor6 lxmxn | Posted 2007-04-24 12:53 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Big sweat... such a huge text file, that's rare indeed!
|
|
| Floor7 vkill | Posted 2007-04-25 02:14 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
| Floor8 wl00560 | Posted 2007-04-25 13:48 |
| 银牌会员 Posts 709 Credits 1,384 | |
|
Simply unbelievable — that's 54 million characters. That's as much as 54 copies of Dream of the Red Chamber. What is it, anyway? I'm curious...
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |