0
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;
4

1 に答える 1