colore Posted March 3, 2008 Share Posted March 3, 2008 helloI need to combine multiple text files in oneI mean to stitch them one after the otheris there a program that can do this?I used TXT Collector and Text Magician but none did it (there are 100,000 txt files)thanks Link to comment Share on other sites More sharing options...
Glenn9999 Posted March 3, 2008 Share Posted March 3, 2008 you should be able to use the straight copy command, I would think.copy *.txt mytextfile.txt Or some such thing. You would have to load the result file up and make formatting changes, etc, but hopefully it should work out for you. Link to comment Share on other sites More sharing options...
colore Posted March 3, 2008 Author Share Posted March 3, 2008 (edited) copy *.txt mytextfile.txtthanks! this works!EDIT:mmm there is a problemthe files are sorted per filename in the explorer and this is the sequence in which I want to combine them:1.txt10.txt20.txtetcbut the above command combines them in this order:1.txt10.txt100.txtetcany idea? Edited March 3, 2008 by colore Link to comment Share on other sites More sharing options...
aadipa Posted March 4, 2008 Share Posted March 4, 2008 may be you can try this.. little longer but it will work for you.copy ?.txt 01.tmpcopy ??.txt 02.tmpcopy ???.txt 03.tmp...like this... this will get all 0.txt - 9.txt in 01.tmp, then 10.txt-99.txt in 02.tmp and so on. once you are done this, then get all tmp files merged.copy *.tmp final.txtA bit lengthy, but it will do the job. Link to comment Share on other sites More sharing options...
colore Posted March 4, 2008 Author Share Posted March 4, 2008 unfortunately it doesn't the jobfor example this:copy ??.txt 02.tmpcombines these:1.txt10.txt100.txt110.txt120.txt130.txt140.txt150.txt160.txt170.txt180.txt190.txt20.txt200.txt210.txt220.txt230.txt240.txt250.txt260.txt270.txt280.txt290.txt30.txt300.txt310.txt320.txt330.txt340.txt350.txt360.txt370.txt380.txt390.txt40.txt400.txt410.txt420.txt430.txt440.txt450.txt460.txt470.txt480.txt490.txt50.txt500.txt510.txt520.txt530.txt540.txt550.txt560.txt570.txt580.txt590.txt60.txt600.txt610.txt620.txt630.txt640.txt650.txt660.txt670.txt680.txt690.txt70.txt700.txt710.txt720.txt730.txt740.txt750.txt760.txt770.txt780.txt790.txt80.txt800.txt810.txt820.txt830.txt840.txt850.txt860.txt870.txt880.txt890.txt90.txt900.txt910.txt920.txt930.txt940.txt950.txt960.txt970.txt980.txt990.txt Link to comment Share on other sites More sharing options...
colore Posted March 4, 2008 Author Share Posted March 4, 2008 (edited) what I suppose would do the job is to put zeros in front of the filenamesbut is there any program that will put zeros in front of the filenames, but make all the filenames have the same number of digits?I mean, it must not just add 3 zeros in front of all filenames, it should add 3 zeros infront of ?.txt filenames2 zeros in front of ??.txt filenames 1 zero in front of ???.txt filenamesetcexample:I have:215061250478122and need:000021506125047800000122 Edited March 4, 2008 by colore Link to comment Share on other sites More sharing options...
IcemanND Posted March 4, 2008 Share Posted March 4, 2008 how's this, will pad the file name with zero's in front to end up with an 8 character filename.@echo offsetlocal enableextensionssetlocal enabledelayedexpansionfor %%? in (*.txt) do ( set fname=%%? set fname=!fname:~0,-4! set nname= for /l %%z in (7,-1,0) do ( if "!fname:~%%z!"=="" ( set nname=0!nname! ) ) ren "%%?" "!nname!%%?") Link to comment Share on other sites More sharing options...
aadipa Posted March 4, 2008 Share Posted March 4, 2008 unfortunately it doesn't the jobfor example this:copy ??.txt 02.tmpcombines these:1.txt10.txt100.txt...i don't think ??.txt will match with 100.txt? represents 0 or 1 charactor. so it will be max 2 digit file name, not 3 digit.but in your case, ??.txt will match both 1.txt and 10.txt.may be you can move files which you have merged to some other folder using move command.copy ?.txt 01.tmpmd 1move ?.txt 1copy ??.txt 02.tmpmd 2move ?.txt 2copy ???.txt 03.tmpmd 3move ?.txt 3 Link to comment Share on other sites More sharing options...
colore Posted March 4, 2008 Author Share Posted March 4, 2008 how's this, will pad the file name with zero's in front to end up with an 8 character filename.@echo offsetlocal enableextensionssetlocal enabledelayedexpansionfor %%? in (*.txt) do ( set fname=%%? set fname=!fname:~0,-4! set nname= for /l %%z in (7,-1,0) do ( if "!fname:~%%z!"=="" ( set nname=0!nname! ) ) ren "%%?" "!nname!%%?")thanksbut how do I use this?aadipa, indeed, I wanted to write ???.txt, sorry Link to comment Share on other sites More sharing options...
IcemanND Posted March 4, 2008 Share Posted March 4, 2008 save it as pad_zeros.cmd in the folder with your files. the double click Link to comment Share on other sites More sharing options...
Grake Posted March 6, 2008 Share Posted March 6, 2008 Use Vim Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now