This is a discussion on reading log files (performance issue) within the Shell scripting forums, part of the Development/Scripting category; Hi All, I am reading some logfiles and parsing data and printing to some textfile. Here is my code OLDIFS=$...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Hi All,
I am reading some logfiles and parsing data and printing to some textfile. Here is my code OLDIFS=$IFS IFS=' ' # just a newline, in single quotes while read data do if [ "$data" != " " -a "$data" != "" ] then #Parsing the Frontend log file MSISDN="`echo "$data" | cut -c1-10`" HOUR="`echo "$data" | cut -c11-16`" ID_SA_SOURCE="`echo "$data" | cut -c17-34`" ID_SA_DEST="`echo "$data" | cut -c35-52`" ID_VIR_PORTAL="`echo "$data" | cut -c53-70`" NW_BEARER="`echo "$data" | cut -c71-74`" TERMINAL_TYPE="`echo "$data" | cut -c 75-75`" TRADE_MODEL="`echo "$data" | cut -c 76-105`" HOUR=$LOGDATE$HOUR echo $HOUR";"$MSISDN";"$ID_SA_SOURCE";"$ID_SA_DEST"; "$ID_VIR_PORTAL";"$NW_BEARER";"$TERMINAL_TYPE";"$T RADE_MODEL >> OFR_Processed_data.txt fi done < $TRACKING_LOGDIR/$listdata In the log file my data is always fixed thats y ia m using cut to get the data. This code is working perfectly, but performance vice its a big failure. while reading a logfile with 1 lakh records its taking morethan 2 hours. Can any one tell y it is taking this much time ? How can i alter my code in a better way ? Thanks in advance Subin |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP code performance | zafar466 | Linux software | 1 | 04-22-2007 08:23 PM |
| Re-reading the partition table failed with error 16: Device | chiku | Linux software | 1 | 12-07-2006 08:45 PM |
| regarding server performance | lovewdhwa | Linux software | 1 | 09-21-2006 01:42 PM |
| Log Off Issue | tkinsella | Linux software | 1 | 08-30-2005 03:03 PM |
| Need Help reading files | mustang | Shell scripting | 1 | 07-22-2005 01:49 PM |