awk
Last updated
Was this helpful?
Last updated
Was this helpful?
By default, it treats spaces/tabs as delimiters. This can be changed using -F'<del>'
.
$NF
(number of fields) represents the last field, while $NR
(number of records) represents the total number of records.
Whatever is within {}
is the awk
script that will be executed for each input line:
is a built-in awk
function, which formats and prints data.
"%s "
defines the string format: the output should be a string (%s
) followed by a space.
$0
represents the entire current line of input in awk
.
We can add a newline character at the end using an END
block:
END {...}
actions within an END
block are executed after all input lines have been processed.