I've written a script that will read an 8 part string that starts with the word -alias-. It extracts the 2nd, 6th and 8th variable and prints it out to htm with count in a table format.
example:
I have 3 problems
One. I would like to further isolate the actual alias word by eliminating the characters starting with the (equal) character in the $varalias string.
Two. I'd also like to be able to parse out the " (quotation) characters in the $vartarget string. The end result would look something like the following example
example:
This way I can use the $varsource and $vartarget variable in other file and directory sub routines
Three. The trickiest, there are times when the input file may contain carriage returns between my wanted strings. Is there a way I can filter them out within the same perl routine?
example: alias tt_clms_copy="/usr/cmvc/cmtools/bin/cm_move.sh -e /cmtest/appsmore/27/hpux/text/cmexports -t /cmtest/appsmore/27/hpux -s /prod1/uat_stage/clmstux/ap_clms"
Attached is the code.
Any help is greatly appreciated. Thanks.
example:
I have 3 problems
One. I would like to further isolate the actual alias word by eliminating the characters starting with the (equal) character in the $varalias string.
Two. I'd also like to be able to parse out the " (quotation) characters in the $vartarget string. The end result would look something like the following example
example:
This way I can use the $varsource and $vartarget variable in other file and directory sub routines
Three. The trickiest, there are times when the input file may contain carriage returns between my wanted strings. Is there a way I can filter them out within the same perl routine?
example: alias tt_clms_copy="/usr/cmvc/cmtools/bin/cm_move.sh -e /cmtest/appsmore/27/hpux/text/cmexports -t /cmtest/appsmore/27/hpux -s /prod1/uat_stage/clmstux/ap_clms"
Attached is the code.
Code:
open(IN, "< prevplanin.txt");
open(OUT, "> prevplanout.htm");
my ($varalias, $varsource, $vartarget);
print OUT "<html><head><title>PLAN VERIFICATION</title></head><body bgcolor=\"\#FFFFFF\" text=\"\#000000\">";
$i = 1;
while(<IN>) {
chomp;
if (m/(alias) (.*) (.*) (.*) (.*) (.*) (.*) (.*)$/) {
$varalias=$2, $varsource=$6, $vartarget=$8;
print OUT "<table width=\"37%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\"><tr bgcolor=\"\#0099CC\"><td colspan=\"2\"><font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\"><b>";
print OUT "<font color=\"\#FFFFFF\">alias retrieved</font></b></font></td></tr><tr><td width=\"11%\" bgcolor=\"\#CCCCCC\"><font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\"><b>";
print OUT "alias</b></font></td><td width=\"89%\" bgcolor=\"\#FFCC99\"><font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\">$varalias</font></td></tr><tr><td width=\"11%\" bgcolor=\"\#CCCCCC\">";
print OUT "<font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\"><b>source</b>";
print OUT "</font></td><td width=\"89%\" bgcolor=\"\#FFCC99\"><font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\">$varsource</font></td></tr><tr><td width=\"11%\" bgcolor=\"\#CCCCCC\">";
print OUT "<font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\"><b>target</b></font></td><td width=\"89%\" bgcolor=\"\#FFCC99\"><font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\">$vartarget</font></td></tr><tr><td colspan=\"2\" bgcolor=\"\#0099CC\">";
print OUT "<font face=\"Geneva, Arial, Helvetica, san-serif\" size=\"2\"><b><font color=\"\#FFFFFF\">$i</font></b></font></td></tr></table><p></p>";
$i = $i + 1;
}
print OUT "</body></html>"
}
close(IN);
close(OUT);
Any help is greatly appreciated. Thanks.