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 16:51

find -name \*.txt | sort -n | xargs cat > out.txt

Thanks a lot. The command seems as though it should work, but i still get the same order as I started out with. I said the filenames incorrectly in my original post. They actually start at A-01.txt, A-02.txt.... A-111.txt...A-699.txt, etc.

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