Re: [opensuse-programmin g-de] Großkleinschreibun g per Skript in html Dateien umwandeln

David Haller <[email protected]>
Newsgroups gmane.linux.suse.programming
Message-ID <[email protected]>
Hello,

On Wed, 02 May 2007, Michael Beuten wrote:
>Ich habe auch noch einen...
>
>======
>use strict;
>
>my $file;
>my $temp;
>
># Filename des HTML-Files
>$file = shift();
>
># File als Ganzes in String lesen
>open (FH,"<$file");
>{
>    local $/;
>    $temp = <FH>;
>}
>close (FH);
>
># Dateinamen in lowercase konvertieren
>$temp =~ s/(<img.*src=\")(.*)(\")/$1\L$2\E$3/g;
>print $temp;

Das geht auch einfacher.

perl -pi.bak -e 's/(<img\s+[^>]*src=)"([^"]+)"/$1"\L$2"/g' *.html

Und wenn man wissen will was das macht:

    perl -MO=Deparse -pi.bak -e '...'

HTH,
-dnh

-- 
Wenn schon, dann höchstens Homo Sapiens Sapiens XEmacensis, die Entwicklungs-
linie, die im Laufe der Evolution sieben Finger an jeder Hand entwickelt hat.
Und das alles nur um alle Tastenkürzel zur Bedienung von XEmacs nutzen zu
können.                                              -- T. Templin über mich
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.