|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Fairly new to unix scripting, hoping to get some help. using AIX v5 Basically I have 3 files 1). Header record 2). many detail record 3). Trailer record My desired result is 1 file which contains Heaeder, Detail, Trailer Currenty I am using a series of: cat detail >> header rm detail cat trailer >> header rm trailer mv header detail Now the problem with this approach is that my detail file quite often is in excess of 5gb, so the time is takes to do the cat seems like a waste of time to me. I would really like to be able to concatenate the header to the beginning of the detail and only "move" the one record. Any ideas would be appreciated. Thanks, |
| Sponsored Links | ||
|
|
|
#2
|
||||
|
||||
|
I assume some program is creating the "detail" file .. how much control over that program do you have? If you could go into it and tell it to stick your header information at the top of the file before it runs through the loop or whatever piece of code creates the 5gb detail file, that might be best...
|
|
#3
|
|||
|
|||
|
control yes, but not enough...
We do have control over the program creating the files, but the header and trailer are created based upon the sum of the detail records so not possible to hold off writing all the details.
Chad. |
|
#4
|
||||
|
||||
|
I assume that before doing the following you already have the header, trailer and detail files
in that case cat header detail trailer > newfile I hope I havent much misunderstood the question ![]() |
|
#5
|
|||
|
|||
|
Quote:
Thanks, |
|
#6
|
||||
|
||||
|
To edit any file in any way you will have to read it directly or indirectly
so any command/script/method will take atleast the time required to open the file and save it bak ![]() so what you need to really worry is that you do minimum possible operations on the huge file but you cannot avoid the time for 1. open 2. read on the file to have it changed ![]() |
|
#7
|
|||
|
|||
|
penguin,
Thanks, that confirms my fear. However, I will try doing it in the one command and see how it works. Thanks for your time and help. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add text to beginning of file | donkey | Shell Programming and Scripting | 2 | 08-24-2007 07:24 AM |
| input a line at the beginning of every file in a directory? | Terrible | Shell Programming and Scripting | 6 | 08-16-2006 06:42 AM |
| Adding a character in the beginning of every line in a .dat file | Cool Coder | Shell Programming and Scripting | 2 | 12-22-2005 05:47 AM |
| Append a field to the end of each line of a file based on searching another file. | ultimate | Shell Programming and Scripting | 2 | 03-29-2005 10:21 AM |
| cat a file from end to beginning | jpprial | UNIX for Dummies Questions & Answers | 5 | 03-31-2001 08:14 AM |