Awk: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
<code>awk <i>pattern</i> {<i>action</i>}</code> | <code>awk <i>pattern</i> {<i>action</i>}</code> | ||
<code> \ </code> The \ tells awk that a special character follows the slash, and to interpret it differently than regular text | |||
Example: <code> \t </code> means a tab character | |||
<code> $ </code> field (column) reference | |||
Example: <code>$2</code> tells awk to do something to the 2nd field (column) of the input | |||
<code></code> | |||
<code></code> | |||
<code></code> | |||
== References == | == References == |
Revision as of 16:10, 30 December 2016
awk parses reports, among other text manipulation
Usage:
awk pattern {action}
\
The \ tells awk that a special character follows the slash, and to interpret it differently than regular text
Example: \t
means a tab character
$
field (column) reference
Example: $2
tells awk to do something to the 2nd field (column) of the input