Changeset: 40042
User: xyz
Date: Friday, July 29, 2011 9:54:52 PM
注释:
[I#1326920] RINS参考数据维护开发完成。添加了RINDefinition,RINEquivalence和RINObligati
产品:
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/application/common/ICTSDatabaseObjectMaps.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/apps/admin/application/client/controller/MainController.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/apps/admin/control/common/AdminCache.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/apps/admin/control/common/AdminManager.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/_RINDefinition.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/_RINEquivalence.java
Changeset: 40043
User: xyzx
Date: Friday, July 29, 2011 9:54:52 PM
注释:
[I#1326920] RINS参考数据维护开发完成。添加了RINDefinition,RINEquivalence和RINObligati
产品:
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/_RINObligation.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/Commodity.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/CommodityType.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/RINDefinition.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/RINEquivalence.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/RINObligation.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/maps/RINDefinitionMap.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/maps/RINDefinitionMap.xml
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/maps/RINEquivalenceMap.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/maps/RINEquivalenceMap.xml
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/maps/RINObligationMap.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/maps/RINObligationMap.xml
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/trade/TradeLocalizedResources.java
登记手续:
Code Reviewer:
Performance Reviewer:
Security Reviewer:
上面的行在一个数组中。我想逐行阅读,如果任何行包含Changeset:
,那么获取Changeset旁边的数字:
请建议我如何做到这一点。
提前致谢。
来自OP评论的代码:
foreach(@loginfo){
#print "$_\n";
@rev = $_=~/^C(\d{1,})/g;
#print "....@rev\n";
push(@rev_value,@rev);
print @rev_value,"\n";
}
答案 0 :(得分:1)
只需使用regexp - man perlre
foreach my $l(@lines) {
if ($l =~ /Changeset:\s+?(\d+)/) {
print "$1\n";
}
}
编辑:
$input = <<EOL;
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/application/common/ICTSDatabaseObjectMaps.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/apps/admin/application/client/controller/MainController.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/apps/admin/control/common/AdminCache.java
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/apps/admin/control/common/AdminManager.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/_RINDefinition.java
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/_RINEquivalence.java
`Changeset: 40043`
edit $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/apps/admin/control/common/AdminCache.java
`Changeset: 4294967295`
add $/S/B/F_RINS/Java/V3/ICTS/src/com/tradecapture/icts/model/commoditymarket/_RINEquivalence.java
`Changeset: 42949672951289312789398123987123`
EOL
foreach my $l(split(/\n/,$input)) {
if ($l =~ /Changeset:\s+?(\d+)/) {
print "number $1\n";
}
}
输出
number 40043
number 4294967295
number 42949672951289312789398123987123
答案 1 :(得分:1)
如果您拥有数组中的所有行,则可以使用map
use v5.10;
my @lines = map /^Changeset:\s*(\d+)/g, @array;
say for @lines;
如果用文件句柄替换数组也可以工作,例如<$fh>
(或任何列表,就此而言)。