Changes

Jump to: navigation, search

Tutorial11: Sed & Awk Utilities

5 bytes removed, 10:07, 4 March 2021
Using the awk Utility
* The expression (contained in quotes) represents selection criteria, and action to execute contained within braces {}
* If selection criteria is matched, then action (between braces) is executed
 
'''Selection Criteria'''
* You can combine any of the patterns using the Boolean operators '''||''' (OR) and '''&&''' (AND).
* You can use built-in variables (like NR or "record number" representing line number) with comparison operators.<br>For example: '''NR >=1 && NR <= 5'''
 
'''Action (execution):'''
* Action to be executed is contained within braces '''{}'''
* The '''print''' command can be used to display text (fields).
* You can use parameters like '''$1''', '''$2''' to represent first field, �second second field, etc. * The parameter '''$0''' represents ALL fields �within within a record (line).* You can use the '''-F''' option with the awk command to specify� specify the field delimiter.
=INVESTIGATION 1: USING THE SED UTILITY=
13,420
edits

Navigation menu