AWK command in Unix/Linux with examples

Published: 12 June 2020
on channel: Decode ITES
1,209
14

#DecodeITeS

Awk is a scripting language used for manipulating the data and generating reports.
The awk command programming language requires no compiling process and allows the user to use variables, numeric functions, string functions, and logical operators as well.

Awk is a utility that enables a programmer to write very tiny but effective programs in the form of statements that define the text patterns that are to be searched for in each line of a document and the action that is to be taken when a match is found within a line. Awk is mostly used for pattern scanning and processing. It searches under one or more files to see if they contain lines that match with the specified patterns we asked for and then perform the associated actions.

Awk is abbreviated from the names of its developers – Aho, Weinberger, and Kernighan.

Syntax:
awk options 'selection _criteria {action }' input-file (less than bracket) output-file

Options:
-f program-file : Reads the AWK program source from the file
program-file, instead of from the
first command-line argument.
-F fs : Use fs for the input field separator

Some Standard examples:

The default behavior of Awk
Print the lines which match the given pattern
Splitting a Line Into Fields


Watch video AWK command in Unix/Linux with examples online without registration, duration 16 minute 40 second in high quality. This video was added by user Decode ITES 12 June 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,209 once and liked it 14 people.