awk
Programm: awk
Wertet Text zeilenweise mit einem kleinen Programm aus.
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
Beispiele
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 Wo du ihn lernst
Lektionen
- Spalten auswerten mit awk Linux-Grundlagen, Modul 3: Text-Werkzeuge