Language Translator

Hacking Zone

Hacking Tools
Attacking

Configure Windows

Windows Configuration

Mix Tutorials

Asterisk
Website Building

Novels

Mix Novels

Human Personality

Body Language
How to Split and Merger long files? Print E-mail

How to Split and Merger long files?

 

Jesus asks: I have a question about the split Command… How can I “come back” to “largefile” from 126 small files?It sounds like the split command was used? If so, then you can use a for loop with file concatenation. First, I will split the files for my example:

$ ls -l big.log
-rw-rw-r-- 1 brock brock 175743061 Oct 11 22:08 big.log
$ expr 175743061 \/ 126
1394786
$ split -b 1394786 big.log
$ ls -1 x*
xaa
xab
...
xew

Split creates its output files in decreasing alphabetic order. Thus when you list them in the shell they are in the order in which
they were split. As such, you can simply use cat to merge the files. (Thanks to Paul and Davidov for pointing out my for loop was superfluous.)

$ cat x* >merged.big.log
$ ls -l *.log
-rw-rw-r-- 1 brock brock 175743061 Oct 12 22:08 big.log
-rw-rw-r-- 1 brock brock 175743061 Oct 12 01:11 merged.big.log
$ diff merged.big.log big.log
$ md5sum *.log
47de08911534957c1768968743468307 big.log
47de08911534957c1768968743468307 merged.big.log




Digg!Reddit!Del.icio.us!Live!Facebook!Slashdot!Technorati!StumbleUpon!Newsvine!Fark!Blogmarks!Yahoo!BlogMemes!FeedMeLinks!
Comments
Add NewSearch
Only registered users can write comments!

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
< Prev   Next >
Your Ad Here

RSS socialnet

Add to MyYahoo!
Subscribe in NewsGator Online
Add to Newsburst
Add to Google
Add to My AOL
Add to Pluck
Subscribe in FeedLounge
Add to Windows Live
Add to NetVibes
Subscribe in Rojo
Subscribe in Bloglines
Add to MyMSN
Add to Plusmo for your cellphone
Add to PageFlakes
Add to Technorati
Add to BlinkBits
buy cheap FFXI Gil now!