awk

Overview

  • awk is a data driven programming language for processing text based data

Basics

  • Print every line in a file

awk '{print}' test.txt
  • Print the lines which contain the given parameter

awk '/item/ {print}' test.txt
  • Print the first and fourth field with whitespace as the delimeter

awk '{print $1,$4}' test.txt 
  • Display a block of text starting with the word start and stopping with the word stop

awk '/start/,/stop/' test.txt

Last updated