Changes

Jump to: navigation, search

Tutorial9: Regular Expressions

224 bytes added, 09:16, 6 July 2020
INVESTIGATION 1: SIMPLE & COMPLEX REGULAR EXPRESSIONS
# Issue the following Linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">grep -w -i "^the" textfile1.txt | more</span><br><br>The '''^''' symbol is an anchor. In this case, it only matches the <u>word</u> "the" (both upper or lowercase) at the beginning of strings.<br>The '''$''' symbol is used to anchor patterns at the end of strings.<br><br>
# Issue the following Linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">grep -w -i "the$" textfile1.txt | more</span><br><br>What do you notice?<br><br>
# Issue the following Linux pipeline command to anchor the work "the" simultaneously at the beginning and the end of the string:<br><span style="color:blue;font-weight:bold;font-family:courier;">grep -w -i "^the$" textfile1.txt | more</span><br><br>What do you notice?<br><br>Anchoring patterns at both the beginning and the end of strings can greatly assist for more complex search patterns. We will now be demonstrating simultaneous anchoring with other complex regular expressions symbols.<br><br>
# x
13,420
edits

Navigation menu