Open main menu

Changes

209 bytes added ,  08:53, 25 September 2018
no edit summary
== Examples ==
; get first column from mw table data
awk '/\|-/{getline;print}' /tmp/terror.txt | sed s/\|// | sed s/'^ *'// | sort -u
 
; see who's trying to SSH into your server (brute force attack)
awk '/Invalid user/ {print $8}' /var/log/auth.log | sort | uniq -c
== Docs ==
The man page for Awk is 27 pages long. Hard to read in a terminal. Here is [[File:Awk.pdf|a PDF copy of the Awk manual|thumb]] a PDF copy of the Awk manual
== One-liners ==
http://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/awk.cheat.sheet.pdf
<center>'''''AWK ([[wp:Alfred_Aho|Aho]], [[wp:Peter_J._Weinberger|Weinberger]], & [[wp:Brian_Kernighan|Kernighan, and Weinberger]]) Summary'''''</center>
|}
'''2007 Peteris Krumins peter@catonmat.net[http://www.catonmat.net/ http://www.catonmat.net] good coders code, great reuse'''
Variable is supported:'''Y'''
| | '''-W lint[=value]--lint[=value]'''
| | Provide warnings about constructs that are dubious or non-portable to other AWK impl�s. With argument '''fatal''', lint warnings become fatal errors. With an optional argument of '''invalid''', only warnings about things that are actually invalid are issued. (This is not fully implemented yet.)
|-
|}
'''2007 Peteris Krumins peter@catonmat.net[http://www.catonmat.net/ http://www.catonmat.net] good coders code, great reuse'''
'''Statements and Functions:'''
|-
| | '''getline'''
| | Set $0 from next input record; set NF, NR, FNR. Returns 0 on EOF and �1 on an error. Upon an error, ERRNO contains a string describing the problem.
4,558

edits