awk FS - Field Separator


Example

The variable FS is used to set the input field separator. In awk, space and tab act as default field separators. The corresponding field value can be accessed through $1, $2, $3... and so on.

awk -F'=' '{print $1}' file
  • -F - command-line option for setting input field separator.
awk 'BEGIN { FS="=" } { print $1 }' file