{" "} Programming Help by Programmers hub

AWK Programming

AWK is an interpreted programming language designed for searching files for lines that contain certain pattern. AWK release the new version which is known as NAWK or new AWK. AWK was in demand in 1970s and 1980s but in 1990s AWK was replaced by the pearl. AWK matches the lines by lines and when a line matches one of the pattern awk perform specific task on that line. Awk progeams are data-driven programming language in which you have to describe the data you wish to work with, and then what to do when you find it. AWK is different from procedural languages in procedural languages you have to describe in details the steps of the program but AWK programming is independent and easy for write and read.

AWK Build-In variables

  • NR: Keeps a current count of the number of input records.
  • NF: Keeps a count of the number of fields in an input record.
  • FILENAME: Contains the name of the current input-file.
  • FS: Contains the "field separator" character used to divide fields on the input record.
  • RS: Stores the current "record separator" character.
  • OFS: Stores the "output field separator", which separates the fields when Awk prints them

Functions and Commands



Return the arctangent of y/x in radians. {N}



Exit from a while, for, or do loop.





Begin next iteration of while, for, or do loop.



Return the cosine of x, an angle in radians. {N}


delete array[element] delete{" "} array

Delete element from array