Difference between revisions of "Command Line Examples: gawk"

From PHYSpedia
Jump to: navigation, search
Line 2: Line 2:
  
 
In the examples that follow, assume that a file name <code>test-data.txt</code> exists and contains 3 columns of data.
 
In the examples that follow, assume that a file name <code>test-data.txt</code> exists and contains 3 columns of data.
 +
 +
eigen % cat test-data.txt
 +
1  11  21
 +
2  12  22
 +
3  13  23
 +
4  14  24

Revision as of 13:24, 20 February 2013

gawk is a powerful stream editor that can be used in command pipelines to perform special functions that do not have a command written for. The easiest use of gawk (and a very common one) is to manipulate the columns in text stream.

In the examples that follow, assume that a file name test-data.txt exists and contains 3 columns of data.

eigen % cat test-data.txt
1  11  21
2  12  22
3  13  23
4  14  24