terminal.cab

Alle Befehle

awk

Thema: Text

Programm: awk

Wertet Text zeilenweise mit einem kleinen Programm aus.

Paket: awk

Aufruf

awk [-F FS] [-v VAR=VALUE] [-f PROGFILE | 'PROGRAM'] [VAR=VALUE | FILE]...

Beschreibung

Run the PROGRAM on every line of the FILEs (or of the keyboard or pipe). A program is a list of PATTERN { ACTION }: the ACTION runs for each line that matches the PATTERN. $1, $2, ... are the fields of the line, $0 is the whole line, NR counts lines, NF counts fields. BEGIN { ... } runs before the first line, END { ... } after the last.

Optionen im Simulator

1 weitere Optionen des echten Programms, im Simulator noch nicht
  • -W braucht einen Wert im Simulator noch nicht

    Im echten Linux stellt -W Besonderheiten von mawk ein (zum Beispiel -W version oder -W interactive).

Beispiele

Aus der Lektion Spalten auswerten mit awk
awk '{print $1}' logs/app.log.1
23:40:12
23:45:31
23:52:08
23:59:58
awk '{print $2, $NF}' logs/app.log.1
INFO 77ms
INFO entries
WARN 1320ms
INFO rotated

Im Terminal ausprobieren

Wo du ihn lernst

Lektionen

Alle Befehle