Thread Problem mit suche [Perl] (12 answers)
Opened by Gast at 2005-06-06 11:08

renee
 2005-06-06 11:50
#5040 #5040
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Das hier funktioniert bei mir:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
#! /usr/bin/perl

use strict;
use warnings;

my $A = 2;
my $file = '15ug.txt';
open(my $fh,"<$file") or die $!;
while(<$fh>){
print if(/5ug$A/.../6\*End/);
}
close $fh;


15ug.txt:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
5ug1
6 1010 aaaaaaa = "1234" bbbbb
6 2020 bbbbbb = "9876" cccccc
6*End
5ug2
6 1020 aaaaaa = "1234" bbbbbb
6 2030 bbbbbb = "9876" cccccc
6*End
5ug3
6 1010 aaaaaaa = "1234" bbbbb
6 2020 bbbbbb = "9876" cccccc
6*End
5ug4
6 1020 aaaaaa = "1234" bbbbbb
6 2030 bbbbbb = "9876" cccccc
6*End


Ausgabe:
Code: (dl )
1
2
3
4
5ug2
6 1020 aaaaaa = "1234" bbbbbb
6 2030 bbbbbb = "9876" cccccc
6*End
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Problem mit suche [Perl]