While the foreach() may be slow, I don't see any way around it if it is possible that the date codes may change. Can you show some code? People may have ideas on how to improve performance of what you've already written.
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of eyal edri
Sent: Friday, March 10, 2006 6:43 AM
To: perl-unix-users@listserv.ActiveState.com; perl-win32-users@listserv.ActiveState.com
Subject: [Perl-unix-users] how to improve text manipulation

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.

 


This message was scanned by ATX
7:37:49 AM ET - 3/10/2006
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to