The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Improve PHP Performance by Caching Database Results iBot Oracle Updates (RSS) 0 04-06-2008 02:10 AM
How to improve grep performance... pooga17 Shell Programming and Scripting 2 02-13-2008 04:34 AM
improve performance by using ls better than find Nicol UNIX for Advanced & Expert Users 3 03-05-2004 05:53 AM
Help! Slow Performance Neo Post Here to Contact Site Administrators and Moderators 6 08-25-2003 12:08 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 02-12-2008
HPAVC's Avatar
Registered User
 

Join Date: Feb 2008
Posts: 105
Quote:
Originally Posted by hidnana View Post
I have uploaded the $key as a screenshot as I don't have the text version right now..., it's a big string concatenated by "|".
I had a feeling it was a bloaded regular expression, a regex optimizer is what you need.

You are giving egrep (which is a grep -E dedicated) a pile of 'check for this or this or this or this'. The form you have it in is quite unwieldy. If that could be reduced to this ...

Code:
TP-CAP-P[0-9]{9}-[0-9]{9}
If your not keen on the regular expression thing you can use a program like regex buddy to load your data in (or a dozen mb or so) and then test it.

Code:
TP-CAP-P123456789-103456789
TP-CAP-P124456789-103456789
TP-CAP-P123458789-123456709
TP-CAP-P123456789-123056719
TP-CAP-P123459989-123406789
and get a sense of the regex back (this is from mkregexp from just the above).

Code:
qr/(?=[1CPT])(?:1(?:23(?:4(?:5670|0678)9|056719)|03456789)|P12(?:345(?:[68]7|99)89|4456789)|(?:T|CA)P)/
My guess is that you want to do something else, but for what your doing a 30seconds isn't that bad for huge files.
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0