Open main menu

CDOT Wiki β

Changes

Tutorial9: Regular Expressions

190 bytes added, 09:25, 13 March 2021
INVESTIGATION 1: SIMPLE & COMPLEX REGULAR EXPRESSIONS
# Issue the following command to check that you created those hard links: <br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/myscripts/week9-check-1</span><br><br>If you encounter errors, then view the feedback to make corrections, and then re-run the checking script. If you receive a congratulation message that there are no errors, then proceed with this tutorial.<br><br>You can also use the '''grep''' command using ''regular expression'' as a '''filter''' in pipeline commands.<br><br>
# Issue the following Linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls | grep "[0-9].*dat$"</span><br><br>What did this pipeline display?<br><br>
# Issue the following Linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls | grep "[0-9].*txt$"</span><br><br>What did this pipeline display?<br><br>
: Although very useful, '''complex''' regular expressions do NOT entirely solve our problem of displaying only '''valid''' unsigned and signed numbers.<br>In the next investigation, you will learn how to use '''extended''' regular expressions that will completely solve this issue.<br>
13,420
edits