Learn to use awk for text and data extraction, data processing, validation, generate reports for analysis, automation with with the help of examples of if else , compare & arrays plus regular expressions & built in operational variables, meaning, examples &command syntax.
awk name & History
The name awk comes from the initials of its creators: Alfred V. Aho, Peter J. Weinberger, and Brian W. Kernighan.
Original version of awk was written in 1977 at AT&T Bell Laboratories. Paul Rubin wrote gawk ( gnu awk ) in 1986.
Original version of awk was written in 1977 at AT&T Bell Laboratories. Paul Rubin wrote gawk ( gnu awk ) in 1986.
Using awk
awk can be used directly on a command line, executed as program file or from a program file referenced by command line awk .
awk Command Line
awk can be used in command line as a tool to process and format the data from one or more input files or output of another program .
Syntax to use data file as input and run awk command to process data
or
Use command output as data input using PIPE processing
Use command output as data input using PIPE processing
awk variable assignments
:
awk works on lines and columns and process data line by line and assigns variables to each line and column.
awk works on lines and columns and process data line by line and assigns variables to each line and column.
and so on
column is defined as a word/characters surrounded by space/s . Common Linux/Unix commands like df ,ls , ps gives columnar outputs and awk is very useful in getting listing and processing column data. A print statement is used to print variables .
column is defined as a word/characters surrounded by space/s . Common Linux/Unix commands like df ,ls , ps gives columnar outputs and awk is very useful in getting listing and processing column data. A print statement is used to print variables .
Working with awk commands
awk commands are enclosed in single quotes, any single quote after awk options is considered as awk command and a matching single quote is taken as as end of command.
0 comments:
Post a Comment