ich habe eine datei, die wird von wpkg erstellt.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<wpkg><package id="acrobat8" name="Acrobat Reader 8.1.2" revision="812" reboot="false" priority="10">
<check type="uninstall" condition="exists" path="Adobe Reader 8.1.2 - Deutsch"/>
<install cmd="msiexec /q /i "%SOFTWARE%\pkg\adobe\AcroRead.msi" allusers=1">
<exit code="0"/>
</install>
<remove cmd="MsiExec.exe /q /x{AC76BA86-7AD7-1031-7B44-A70500000002}"/>
<upgrade cmd="msiexec /q /i "%SOFTWARE%\pkg\adobe\AcroRead.msi" allusers=1">
<exit code="0"/>
<exit code="3010"/>
</upgrade>
</package>
<package id="ReportViewer" name="Microsoft Report Viewer Redistributable 2008" revision="2" reboot="false" priority="10">
<check type="uninstall" condition="exists" path="Microsoft Report Viewer Redistributable 2008"/>
<install cmd="%SOFTWARE%\pkg\wsus\ReportViewer.exe /q">
<exit code="0"/>
</install>
<remove cmd="%SOFTWARE%\pkg\wsus\ReportViewer.exe /qu"/>
</package>
<package id="pdfcreator" name="PDFCreator" revision="091" priority="0" reboot="false">
<check type="uninstall" condition="exists" path="PDFCreator"/>
<install cmd="msiexec /qb /i "%SOFTWARE%\pkg\pdfcreator\PDFCreator-0_9_1_AFPLGhostscript_32bit.msi""/>
<install cmd="rundll32 printui.dll,PrintUIEntry /q /ga pdfcreator"/>
<remove cmd="MsiExec.exe /q /x{0001B4FD-9EA3-4D90-A79E-FD14BA3AB01D}"/>
<upgrade cmd=""/>
</package>
....
wie kann ich jetzt den block suchen (finden)
<package id="ReportViewer" name="Microsoft Report Viewer Redistributable 2008" revision="2" reboot="false" priority="10">
<check type="uninstall" condition="exists" path="Microsoft Report Viewer Redistributable 2008"/>
<install cmd="%SOFTWARE%\pkg\wsus\ReportViewer.exe /q">
<exit code="0"/>
</install>
<remove cmd="%SOFTWARE%\pkg\wsus\ReportViewer.exe /qu"/>
</package>
mit dem code unten finde ich alles bis zum ende der datei.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
open(INFILE, "</test.xml") or die "Can't open input.txt: $!";
open(OUTFILE, ">output.txt") or die "Can't open output.txt: $!";
my $string = do { local $/; <INFILE> };
my $text = $string;
$text =~ s/(<package id="ReportViewer" name="M.*<\/package>)//ms;
print $&;
print OUTFILE $text;
close INFILE;
close OUTFILE;
hoffe ihr könnt mir helfen.
gruß michael
Last edited: 2011-04-05 14:34:07 +0200 (CEST)