Awk: Difference between revisions
Jump to navigation
Jump to search
(→Tips) |
|||
Line 1: | Line 1: | ||
== References == |
== References == |
||
* [http://www.vectorsite.net/tsawk.html An Awk Primer (good tutorial on Awk)] |
* [http://www.vectorsite.net/tsawk.html An Awk Primer (good tutorial on Awk)] |
||
== Awk Program Examples == |
|||
<source lang="bash"> |
|||
ps al | awk '{print $2}' # Print second field of ps output |
|||
</source> |
|||
== Tips == |
== Tips == |
Revision as of 09:56, 15 February 2011
References
Awk Program Examples
ps al | awk '{print $2}' # Print second field of ps output
Tips
- Defining environment variable - Using an Awk script and Bash builtin eval
eval $(awk 'BEGIN{printf "MY_VAR=value";}')
echo $MY_VAR