linux_wiki:awk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux_wiki:awk [2015/03/09 22:53]
billdozor
linux_wiki:awk [2019/05/25 23:50]
Line 1: Line 1:
-====== Awk ====== 
  
-**General Information** 
- 
-AWK is a pattern scanning and processing language. 
-Gawk is the GNU Project's implementation of the AWK programming language. 
- 
-I typically stick to using gawk and in most cases, awk is a symlink to gawk. 
-This page will contain useful gawk commands as I run into them. 
- 
-**Checklist** 
-  * Distros: All 
-  * gawk installed 
- 
----- 
- 
-===== Gsub ===== 
- 
-gawk's gsub string function matches and replaces regular expressions. This can replace a grep | sed combination. 
-<code bash> 
-~$ echo -e "Hello, friend.\nHello, how are you?\nI am fine." | gawk 'gsub(/Hello/,"Goodbye")' 
-Goodbye, friend. 
-Goodbye, how are you? 
-</code> 
-Notice that the last line "I am fine." is not displayed at all because it doesn't match the regex. (Hello) 
  • linux_wiki/awk.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)