Leser: 27
Quoteabc
abc
abc
def
def
Quotea b c
a b c
a b c
d e f
d e f
1 2 3 4 5 6 7 8 9 10 11 12 13 14
use strict; use warnings; my @content; open my $fh, 'datei.txt' or die "datei.txt"; { local $/ = "\n\n"; while ( my $block = <$fh> ) { # alle Umbrüche in Block entfernen $block = tr/\r\n//d; push @content, $block; } } close $fh;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl use strict; use warnings; local $/ = "\n\n"; my @blocks = <DATA>; $_ =~ s/\n//g for @blocks; print join "::", @blocks; __DATA__ abc abc abc def def
$_ =~ s/[\r\n]//g for @blocks;
$_ =~ s/[\x0D\x0A]//g for @blocks;
1
2
3
4
5
6
7
8
9
10
11
open(IMPORTDFSFILE,"import.xml");
my @lines = <IMPORTDFSFILE>;
open(EXPORTDFSFILE,">exporttest.xml");
select (EXPORTDFSFILE);
print @lines;
close(EXPORTDFSFILE);
close(IMPORTDFSFILE);
exit(0);
Quote<?xml version="1.0"?>
<Root Name="\\server\stamm" State="1" Timeout="300" >
<Target Server="server" Folder="stamm" State="2" />
Quote<?xml version="1.0"?>
ഀഀ
<Root Name="\\server\stamm" State="1" Timeout="300" >
ऀ㰀吀愀爀最攀琀 匀攀爀瘀攀爀㴀∀搀攀 ⴀ搀昀猀 ⴀ椀∀ 䘀漀氀搀攀爀㴀∀䄀䌀䔀开䤀一吀䔀䜀刀䄀吀䤀伀一∀ 匀琀愀琀攀㴀∀㈀∀ ⼀㸀ഀഀ
2010-01-20T07:31:56 BrennerHabe mal die Lösung von Linuxer probiert, aber da passiert irgendwie gar nichts. :-(
2010-01-20T08:21:36 BrennerIch hatte versucht direkt Werte ausgeben zu lassen um zu sehen ob überhaupt was drin ist...
Quotemy @content;
open my $fh, 'datei.txt' or die "datei.txt";
{
local $/ = "\n\n";
while ( my $block = <$fh> ) {
# alle Umbrüche in Block entfernen
$block = tr/\r\n//d;
push @content, $block;
}
}
close $fh;
Quotemy @content;
open my $fh, 'test2.xml' or die "test2.xml";
{
local $/ = "\n\n";
while ( my $block = <$fh> ) {
# alle Umbrüche in Block entfernen
$block = tr/\r\n//d;
print $block; ####Geht das nicht?
push @content, $block;
}
}
close $fh;
open(EXPORTDFSFILE2,">exporttest2.xml");
select (EXPORTDFSFILE2);
print @content;
close(EXPORTDFSFILE2);
2010-01-18T08:24:23 BrennerCode: (dl )1
2
3
4
5
6
7
8
9
10
11open(IMPORTDFSFILE,"import.xml");
my @lines = <IMPORTDFSFILE>;
open(EXPORTDFSFILE,">exporttest.xml");
select (EXPORTDFSFILE);
print @lines;
close(EXPORTDFSFILE);
close(IMPORTDFSFILE);
exit(0);