Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Merging thousands of txts

Name: Anonymous 2009-04-06 16:17

Hello gentlemen,

I'm no programmer so forgive me if I use incorrect terms or fail to address important points.

I have tens of thousands of txt files which I have as a result of, among other things, a ton of OCR scanning of different texts. The naming scheme is A-1.txt with each subsequent page adding 1 to the number.

What I need to do is put all the txt files together into one. I'm on a linux machine and have failed to put them together in order. I've tried 'cat A-*.txt > new.txt' and the pages are merged out of order. The pages in the new.txt begin with any file that begins with A-1* and then any file that begins with A-2*, etc. I'm trying to find a way to put all these in order in such a way that the order will go A-1.txt, A-2.txt, A-3.txt, etc. Basically, I went them in Dewey Decimal order (I think).

I'm sure this could be easily done with a simple bash script, but I'm pressed for time in getting this together and don't have enough time to learn/experiment with it.

Name: Anonymous 2009-04-06 18:03

>>5
For some reason It that spits them out in the same order as a lone 'ls' command, but in a single column. With A-71.txt being after 6999.txt.

I did however figure something out with the 'sort' command you introduced me to. I did 'ls | sort -n' and for some reason that spit out the order I was looking for so I put it into a txt file and with emacs I replaced the newlines with spaces and added 'cat' to the beginning and '> out.txt' to the end and it worked like a charm!

Thanks a bunch!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List