Article View: ch.comp.os.linux
Article #23252Re: zeilen ausschneiden
From: Marc-A. Woog
Date: Mon, 05 Apr 1999 00:00
Date: Mon, 05 Apr 1999 00:00
50 lines
1526 bytes
1526 bytes
On Wed, 31 Mar 1999 14:50:01 +0200, "Urs Steiner" <urs.steiner@maximilianeum.ch>
wrote in <7dt5iq$3at$1@nerys.maximilianeum.ch>:
Hi Urs,
>ich sollte aus einem file einen Teil ausschneiden (automatisch)
>
>das ganze sieht so aus :
>fgndghkm
>hmnf
>kjhzkmfizl,ugi<fasel>fdhstgh
>tghrdtzuj
>fehz
>ghjezt<bla>
>
>und ich sollte alles zwischen <fasel> und <bla> (inklusive) weg
>schneiden
>kennt da einer ne Methode mit nem Script das zu machen '
Wie waere es so?
--------------------
#!/usr/local/bin/perl -w
use strict;
my $text;
while (<DATA>) {
$text .= $_;
}
$text =~ s#<cut>.*?<end>##gs;
print $text;
exit(0);
__END__
This is a test text<cut>
and this is not to be shown<end>
This is the end
And again<cut>This goes away<end> we have more text.
--------------------
Output:
This is a test text
This is the end
And again we have more text.
--------------------
Gruss
Marc
Technical Details
Message-ID:
<370a805c.2477637@news.datacomm.ch>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7dt5iq$3at$1@nerys.maximilianeum.ch>Show Full Headers
Complete Article Headers
X-Google-Language: GERMAN,ASCII-7-bit X-Google-Thread: f4b73,c11bcbff67c4d993 X-Google-Attributes: gidf4b73,public From: mwoog@gmx.net (Marc-A. Woog) Subject: Re: zeilen ausschneiden Date: 1999/04/05 Message-ID: <370a805c.2477637@news.datacomm.ch> X-Deja-AN: 462812855 Content-Transfer-Encoding: quoted-printable References: <7dt5iq$3at$1@nerys.maximilianeum.ch> Content-Type: text/plain; charset=us-ascii X-Trace: 5 Apr 1999 11:22:01 +0100, line256.datacomm.ch Organization: DataComm (Schweiz) AG MIME-Version: 1.0 Reply-To: mwoog@gmx.net Newsgroups: ch.comp.os.linux