Einfache Lösung

Skript in bsp.awk:

$1~/^[1-9]/ {
     id = $1
     print $2, $3
     i=0
     
     while((getline < "konto") > 0)
     {
       if($3 == id)
       {
         print "\tKonto", ++i, ": ", $2
       }
     }
     close("konto")
}

Anweisung: awk -f bsp.awk inhaber > kombiniert

Hinweis: Die gezeigte Lösung ist nur für kleine Dateien sinnvoll. Für das Einlesen größerer Dateien werden andere Strategien effizienter sein.


zurück

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.