Hi graff,
Here i am explaining in detail what actually i am trying
to extract.
I am working on a task to get the vob storage path from the
list of vobtags.below is the command i am running on command prompt
bash-3.00$cleartool lsvob -s #which will give all vobtag list as below.
/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
#!/usr/bin/perl -w
$arg=$ARGV[0];
$cmd="cleartool lsvob $arg"
$arr=`$cmd`;
print "$arr\n";
after running this script with argument as vobtag list that i got from running "cleartool lsvob -s" command
like as bash-3.0$cleartool lsvob /vobs/cs_test_scripts from
command prompt will give the result as below
* /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
the output contains three parts */vobs/cs_test_script,*/scm are as vobtags
/usr/add-on/puccase_vob01/ccvob01/cs_test_scripts.vbs is vobstorage directory path
and last part is type as "public (replicated)".
from this i want to extract vobstorage path of each vobtag
that i am supling vobtag(/vobs/cs_test_script)as argument
to the below script,in that i am matching the output for the tags with 2 slashes in it ex:/vobs/cs_test_script and
vobtag with one slash in it ex:/scm
with regular expression that has to match the output for
both type of vobtags(/vobs/cs_test_script,/scm)by using
alternation operator in patternmatching as below script
#!/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";
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
bash-3.00$ perl scriptname.pl /vobs/cs_test_script
bash-3.00$ perl scriptname.pl /scm
* /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
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...
Monks sorry for repeated posting of same qustion again and again...the problems seems to simple for u people ....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.