Linux Utilities

The cut command is a command-line utility for cutting sections from each line of a file. It writes the result to the standard output. It’s worth noting that it does not modify the file, but only works on a copy of the content. Although typically the input to a cut command is a file, we can pipe the output of other commands and use it as input.

It can be used to cut parts of a line by byte position, character and field. Basically the cut command slices a line and extracts the text. It is necessary to specify option with command otherwise it gives error. If more than one file name is provided then data from each file is not precedes by its file name.

The following is a list of variables that awk sets automatically on certain occasions in order to provide information to your program. The variables that are specific to gawk are marked with a pound sign (#). These variables are gawk extensions. In other awk implementations or if gawk is in compatibility mode (see section Command-Line Options ), they are not special.

VARIABLE NAME DESCRIPTION
FS input field separator variable
OFS Output Field Separator
RS Input Record Separator variable
ORS Output Record Separator Variable
NR Number of Records
NF Number of Fields in a record
FILENAME Name of the current input file
FNR Number of Records relative to the current input file
RLENGTH length of the substring matched by the match() function
RSTART first position in the string matched by match() function

FS - input field separator variable

It represents the (input) field separator and its default value is space. You can also change this by using -F command line option.