regex problem | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

regex problem

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-12-2009
namishtiwari namishtiwari is offline Forum Advisor  
Registered User
 
Join Date: Aug 2007
Last Activity: 2 October 2012, 1:31 PM EDT
Location: Bangalore
Posts: 390
Thanks: 0
Thanked 0 Times in 0 Posts
regex problem

Hi,


Code:
#!/usr/bin/perl -w
my $timestamp;
my $line = "Fri May 29 18:29:57.357 2009 Morocco Standard Time INFO: pid 3216 tid 1724: 170: 132192: apricocot Native Server: recvd AA_BIN_MSG_VER_CHG";
     	if ($line =~ /^(.*) INFO: .*  recvd AA_BIN_MSG_VER_CHG/) {
	   $timestamp = $1;
           print $timestamp;
         }

My regular expression the if statement is not correct, kindly help me in correcting it.

Thanks
NT

Last edited by namishtiwari; 06-12-2009 at 10:06 AM..
Sponsored Links
    #2  
Old 06-12-2009
KevinADC KevinADC is offline Forum Advisor  
Registered User
 
Join Date: Jan 2008
Last Activity: 11 September 2009, 3:44 PM EDT
Posts: 729
Thanks: 0
Thanked 0 Times in 0 Posts

Code:
if ($line =~ /^(.*)INFO:.*recvd AA_BIN_MSG_VER_CHG/) {

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Regex saikrishnan7 Shell Programming and Scripting 1 05-30-2009 08:38 PM
Simple regex problem? muay_tb Shell Programming and Scripting 1 03-31-2009 09:49 PM
Problem with grep Regex Error lweegp Shell Programming and Scripting 6 11-16-2006 03:04 AM
gcc 3.4 Regex problem manishs13 Solaris 0 05-09-2005 03:58 AM
grep regex problem iceman Shell Programming and Scripting 2 02-06-2005 11:44 AM



All times are GMT -4. The time now is 10:58 PM.