AWK Howto

From LinodeWiki

Jump to: navigation, search

[edit] Examples

  • Some examples using AWK as scripts
#! /bin/awk -f

# a sample awk program using a WHILE statement 
# usage: script.awk <filein> 
# chmod: 755

BEGIN {
    FS=" "
   # RS=""
    ORS=""
}
{
        x=1
        while ( x<NF ) {
                print $x " "
                x++
        }
        print $NF "\n"
}


[edit] Links

  1. Awk by example, Part 1
  2. Awk by example, Part 2
  3. Awk by example, Part 3
  4. The GAWK Manual
Personal tools