User Tools

Site Tools


awk:awk_commands

Differences

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

Link to this comparison view

Next revision
Previous revision
awk:awk_commands [2020/05/04 23:56] – created peterawk:awk_commands [2022/06/13 09:32] (current) peter
Line 3: Line 3:
 Commands used by AWK can come from two locations: Commands used by AWK can come from two locations:
  
-  * They can be specified on the command line, as used in the above examples.+  * They can be specified on the command line.
   * Alternatively they can come from a source file.  If such is the case, AWK is alerted to this occurrence by means of the **-f** option.   * Alternatively they can come from a source file.  If such is the case, AWK is alerted to this occurrence by means of the **-f** option.
  
 ---- ----
 +
 +Assuming a file, **test.txt**, exists with the following contents:
 +
 +<file>
 +10   Peter     Terence   Roux        45
 +11   Virginia  Genevieve  Roux       45
 +12   Felix     Devon     Roux         5
 +13   David     Bruce     Stevenson   48
 +14   Bob       James     Smith       16
 +48   Adam      Winter    Ridley      23
 +</file>
 +
 +----
 +
  
 ===== Simple Command File ===== ===== Simple Command File =====
  
-Assuming a file exists with following contents:+Assuming a command file exists with following contents:
  
 <file awk awklist> <file awk awklist>
Line 19: Line 33:
 Issue the following command: Issue the following command:
  
-<code bash+<code awk
-awk -f awklist /sharewiz/awk/test.txt+awk -f awklist test.txt
 </code> </code>
  
-which will display something like:+returns:
  
 <code> <code>
Line 29: Line 43:
 Roux 45 Roux 45
  
-Virginia Genevive+Virginia Genevieve
 Roux 45 Roux 45
  
Line 45: Line 59:
 </code> </code>
  
-Notice that the apostrophes are not used anywhere within the source file or when calling it at the command line.+<WRAP info> 
 +**NOTE:**  The apostrophes are not used anywhere within the source file or when calling it at the command line
 + 
 +  * They are only for use in differentiating the commands on the command line from file names.
  
-They are only for use in differentiating the commands on the command line from file names.+</WRAP>
  
awk/awk_commands.1588636576.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki