Changes

Jump to: navigation, search

Tutorial11: Sed & Awk Utilities

462 bytes removed, 10:06, 4 March 2021
Using the awk Utility
[[Image:awk.png|thumb|right|300px|'''Comparison operators''' used with the '''awk''' command.]]'''PatternsAction (execution): Relational Operators'''
*The following operators (in the table on the right-side) can Action to be used with the awk utility to pattern searching. executed is contained within braces {}*Since those symbols are used within the expression, they are NOT confused with redirection symbols.  The '''Examples:print''' <span style="font-family:courier;">'''awk 'NR == 3 {print}' command can be used to display text.txt''' (print 3rd linefields)<br>.* You can use parameters like '''awk 'NR >= $1 && NR <= 5 {print}' text.txt''' (print lines 1 to 5)<br>''$2'awk '/NOTE:/ {print]' text to represent first field, �second field, etc.txt''' (print lines that contain the pattern: "NOTE:")<br><br>* The parameter '''awk -F";" '$1 ~ /ford/ {print}' cars.dat0''' represents ALL fields �within a record (print records (of semi-colon delimited fileline) whose 1st field matches: "ford")<br>.* You can use the '''awk -F";" '$1 ~ /ford/ {print $2,$4}' cars' option with the awk command to specify� the field delimiter.dat''' (same as above, but only print 2nd and 4th fields)<br><br></span>
=INVESTIGATION 1: USING THE SED UTILITY=
13,420
edits

Navigation menu