Results 1 to 5 of 5
Hi all
Everything is a first once, and here is my first post.
I'm curious about the low level functionality of cat. The background is that I have a script ...
- 11-05-2008 #1Just Joined!
- Join Date
- Nov 2008
- Location
- Stockholm
- Posts
- 4
append files, or low level 'cat'
Hi all
Everything is a first once, and here is my first post.
I'm curious about the low level functionality of cat. The background is that I have a script that calibrates datafiles and after calibration appends them total calibrated file.
The problem is that this collected file quickly grows and easily reach >500Mb, when running the append command
> cat COLLECTED_FILE NEW_FILE > NEW_COLLECTED_FILE
I can go and have a cuppa because the computer completely grinds to a halt for a while.
My understanding is that cat reads in the old file, the new file and then append them thus there is a lot of reading and writing when the files grow.
Is there a way to speed up this process, or do I have to do these things at night?
Thanks
- 11-05-2008 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
Just append to the existing file.
Code:# cat NEW_FILE >> COLLECTED_FILE
- 11-05-2008 #3Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Yep. That way you avoid having to read one of the files.
Also, you can use "nice" to set up a better niceness for that process so it's softer in terms of cpu. If udma is on, your box shouldn't be irresponsive when doing this though. If so, then there's some problem at some level.
Using a sane fs (read, anything but reiserfs) will probably also save you some cpu cycles.
- 11-06-2008 #4Faster, but not recommended if you're worried about the system or the process dying before the appending is finished. It depends on how bulletproof this situation needs to be.Just append to the existing file.--
Bill
Old age and treachery will overcome youth and skill.
- 11-06-2008 #5Just Joined!
- Join Date
- Nov 2008
- Location
- Stockholm
- Posts
- 4
*thump*, the sound of my head against the desk...
I knew there was a better way! Thanks a lot.


Reply With Quote