in reply to Re^3: Problem in pattern matching with alternation
in thread Problem in pattern matching with alternation
/vobs/cs_test_scripts /vobs/openwall_pam_userpass_rel /vobs/cs_cim /vobs/PIP_PVOB /vobs/pvob_ic /v_dialer3rdparty /v_dialerclient /v_dialer_rel /scm
after running this script with argument as vobtag list that i got from running "cleartool lsvob -s" command#!/usr/bin/perl -w $arg=$ARGV[0]; $cmd="cleartool lsvob $arg" $arr=`$cmd`; print "$arr\n";
the output contains three parts */vobs/cs_test_script,*/scm are as vobtags* /vobs/cs_test_scripts /usr/add-on/puccase_vob01/ccvob01/cs_test_scri +pts.vbs public (replicated) * /scm /usr/add-on/puccase_vob01/ccvob01/scm.test.vbs
I am running the script with both type of vobtags as /vobs/cs_test_scripts and /scm as arguments so its printing the match for both $storage1 and $storage2 as below#!/usr/bin/perl $arg=$ARGV[0]; $cmd1="cleartool lsvob $arg"; $arr=`$cmd1`; print "$arr\n"; $storage1=$1 if($arr=~/^*\s+\/\w+\/\w+\s+(.+)\s+\w+/); print "$storage1\n"; $storage2=$1 if($arr=~/^*\s+\/\w+\s+(.+)\s+\w+/); print "$storage2\n"; $storage3=$1 if($arr=~/^*\s+\/\w+\/\w+\s+(.+)\s+\w+|^*\s+\/\w+\s+(.+)\ +s+\w+/); print "$storage3\n";
In $storage3 variable i am combining the pattern match of storage1 and storage2 by alternation operator,it should work for both type of vobtag arguments,i am not getting where i am doing wrong...* /vobs/cs_test_scripts /usr/add-on/puccase_vob01/ccvob01/cs_test_scri +pts.vbs public (replicated) #match storage1 /usr/add-on/puccase_vob01/ccvob01/cs_test_scripts.vbs * /scm /usr/add-on/puccase_vob01/ccvob01/scm.vbs publi +c (replicated) #storage2 /usr/add-on/puccase_vob01/ccvob01/scm.vbs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Problem in pattern matching with alternation
by graff (Chancellor) on Aug 12, 2007 at 20:13 UTC | |
|
Re^5: Problem in pattern matching with alternation
by FunkyMonk (Bishop) on Aug 12, 2007 at 17:57 UTC |