#!/usr/bin/perl -w
######################################################################
# (c) Michael Schilli 1999
######################################################################

open(FILE, "mquote.dat") || die "Cannot open mquote.dat";

while(<FILE>) {

    s/#.*//;          # Kommentare entfernen
    next if /^\s*$/;  # Leerzeichen ignorieren

    @columns = ();    # Zwischenspeicher löschen

    while(/("(?:\\\\|\\"|.)*?")| # "Parameter"
           (\S+)                 # Oder: Parameter
          /gx) {
        my $match = $+;          # Treffende Alternative
        if(defined $1) {         # Parameter in 
                                 # Anführungszeichen?
            $match =~ s/^"//;    # Führende " entfernen
            $match =~ s/"$//;    # Abschließende " weg
        }
        $match =~ s#\\\\#\\#g;   # \\ -> \
        $match =~ s#\\"#"#g;     # \" -> "
        push(@columns, $match);  # Abspeichern
    }

    # Ergebnis ausgeben:

    print shift(@columns), "\n";  # Erstes Schlüsselwort
    foreach (@columns) {          # Restliche Einträge 
        print "    $_\n";         # der Zeile
    }
}
close(FILE);
