Changes

Jump to: navigation, search

Tutorial11: Sed & Awk Utilities

445 bytes removed, 10:50, 4 September 2020
Using the awk Utility
*The following operators (in the table on the right-side) can be used with the awk utility to pattern searching.
*Since those symbols are used within the expression, they are NOT confused with redirection symbols.
<br><br><br><br>
'''Examples:'''
<span style="font-family:courier;">'''sed -n '3 p' text.txtx''' (print 3rd linex)<br>'''sed -n '1-5 p' text.txtx''' (print lines 1 to 5x)<br>'''sed -n '4,7 p' text.txtx''' (print only lines 4 and 7x)<br>'''sed -n'/^Therefore/ p' text.txtx''' (print lines that begin with the patterh "Therefore"x)<br><br>'''sed '/^#/ d' myscript.bash''' (remove comments at beginning of line)<br>'''sed '/exit/ q' text.txtx''' (print all lines until line containing pattern: "exit"x)<br>'''sed 's/this/that/' text.txtx''' (replace first occurrence of pattern "this" with "that"x)<br>'''sed 's/this/that/' text.txtx''' (replace ALL occurrences of pattern "this" with "that"x)<br><br></span>
=INVESTIGATION 1: USING THE SED UTILITY=
13,420
edits

Navigation menu