hi,

i need your help in finding the right commands to do a certain log file manipulation.

whats needs to be done:

1. Copy all lines from a log file which matches a certain 'datecode' (yyyymmddhh) (the starting column of this code is known) into a new    filename with the same datecode.

line example:     56656   3   106256   0 0 52006022309509    48602       0.0 0 1 0 
datecode in blue.

(it could be that i could use the 5/509 delimiters also instead of the column number).

2. Also, if given, only the first XX chars of each line in this file is to be copied to the new file.

what i did and it's not good enough:

1. i've implemented this using ordinary "foreach $line (@lines)" file processing, which is very slow when handeling large files.
    and then it's quite easy. (using substr and such...).

what i think needs to be done (and here i need your advice):

1. Extract the datecodes (there's more than one) from the logfile (without having to read every line.. )
2. 'grep' all lines matching a certain datecode and dump it to the target file (with the same datecode)
    (while checking if the length of each lines should be chopped/limited to XX CHARS.)

I know that using ''awk''/''sed''/"grep" suppose to produce better results.
Also using regular expressions will probably improve performance.


currently i'm at a loss, trying to search bits and pieces that will solve the problem.

i appreciate your help.





--
Eyal Edri | System & Security Engineer  | [EMAIL PROTECTED] Communication.
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to