Inhalt - bash - Bash Stream Funktionen - AWK - AWK Commands
AWK Commands
Datum:
28. Dezember 2025 03:15
Command Beschreibung Beispiel
print
print $0
ganze Zeile "as-is" (default block) echo "a b   c" | awk '{ print $0 }'
⇒ a b   c
print $1 / print $2 / ... xtes Wort (ohne quotes) pro Zeile echo "foo text" | awk '{ print $2 }'
⇒ text
print "Text" $1 "Text" 3 Werte werden concatiniert echo "foo text" | awk '{ print "A" $1 "B" }'
⇒ AfooB
print "Text", $1, "Text" 3 Werte werden mittels OFS concatiniert echo "foo text" | awk '{ print "A", $1, "B" }'
⇒ A foo B (see OFS)
printf "format", Zahl/Formel format "%.0f" ganzzahlig runden (ohne NL) echo "123.789" | awk '{ printf "%.0f", $1 }'
⇒ 124
printf "format", "Text" format "%s" Text in format einsetzen (ohne NL) echo "foo text" | awk '{ printf "%s is %s", $2, $1 }'
⇒ text is foo
Haftungsausschluss: Die Informationen auf dieser Website wurden mit grösster Sorgfalt erstellt. Dennoch übernehme ich keine Haftung für die Richtigkeit, Vollständigkeit oder Aktualität der Inhalte. Änderungen und Irrtümer sind vorbehalten.
Java HotSpot™ Client VM 1.8.0_401 / © Thomas Gürber