New Features:
- Plumbing for DSI dynamic refresh rate change
- jdflksjdfksjdkfjsdf
-jdksjfdkjfskjdfskf
Fixes:
- Fix KW issue 7449.
- Adding fix to avoid reading EDIDPO twice on each HPD, EDID cache
- Mark layer unused to allow the test to run.
Fixed CRs: 3847263, 498327498, 92834927
上面的文本在我的文本文件中重复了几次。我想解析每次出现并提取数据以放入下一个文本文件中,该文件将列出“新功能”下的所有新功能、“修复”下的修复和“固定 CR”下的固定 CR。
如何进一步改进我的代码以使其正常工作?现在,输出仅在标题下显示新功能。换句话说,我想重新使用我的子程序myparser()
来获取“Fixes:”和:Fixed CRs:之间以及“Fixed CRs:”和行尾输出之间的行:
New Features:
-Plumbing for DSI dynamic refresh rate change
-add watchdog support for 8084 and 8x62
-Displays supported and the features supported for each of them has been made chip-specific.
-Size optimization for eventlog
-Integrate new power framework from the development sandbox
-New KMD CAP: supportsDummyPageMapping
-Adding support for chipID GfxLibChipIDOxili305Dino
-Using parent driver to handle thermal mitigation request instead of AV stream
下面是我的代码:
#!perl -w
use strict;
use autodie;
use warnings;
open (FILE_IN,"<S2.txt") or print "Failed to open S2.txt\n" and die;
open FILE_OUT,"+>ramu_15.txt" or print "Failed to open S2.txt\n" and die;
my $a = "New Features:";
my $b = "Fixes:";
my $c = "Fixed CRs:";
sub myparser () {
my $started = 0;
my $printFeatures = 1;
print "START....\n";
my @lines = <FILE_IN>;
foreach (@lines) {
if ($_ =~ /$a/) {
if ($printFeatures == 1) {
print FILE_OUT $_;
$printFeatures = 0;
}
$started = 1;
next;
}
if ($started == 1) {
if ($_ !~ /$b/) {
print "$_\n" if $_ ne "\n";
print FILE_OUT $_ if $_ ne "\n";
}
else {
$started = 0;
}
}
}
}
myparser();
print "...END\n";
close FILE_IN;
close FILE_OUT;