Changes

Jump to: navigation, search

Tutorial11: Sed & Awk Utilities

141 bytes added, 10:08, 4 September 2020
Using the awk Utility
'''Examples:'''
<span style="font-family:courier;">'''awk 'NR == 3 {print}' text.txt''' (print 3rd line)<br>'''awk 'NR >= 1 && NR <= 5 {print}' text.txt''' (print lines 1 to 5)<br>'''awk '/NOTE:/ {print]' text.txt''' (print lines that contain the pattern: "NOTE:")<br><br>'''awk -F";" '$1 ~ /ford/ {print}' cars.dat''' (print records (linesof semi-colon delimited file) whose 1st field matches: "ford")<br>'''xawk -F";" '$1 ~ /ford/ {print $2,$4}'' (x)<br>'''xcars.dat''' (xprint second and fourth fields of records (of semi-colon delimited file)<br>'''x''' (xwhose 1st field matches: "ford")<br><br></span>
=INVESTIGATION 1: USING THE SED UTILITY=
13,420
edits

Navigation menu