Open main menu

CDOT Wiki β

Changes

Tutorial 9 - Regular Expressions

17 bytes removed, 21:49, 25 October 2021
REVIEW QUESTIONS: REGULAR EXPRESSIONS (INCLUDING EXTENDED REGULAR EXPRESSIONS)
Write the results of each of the following Linux commands using regular expressions for the above-mentioned file.
1. <span style="font-family:courier;font-weight:bold">grep "^[-+]" ~murray.saulosl640/uli101tutorial9/numbers.txt</span><br>2. <span style="font-family:courier;font-weight:bold">grep "^[-+]*.[0-9]" ~murray.saulosl640/uli101tutorial9/numbers.txt</span><br>3. <span style="font-family:courier;font-weight:bold">grep "^[+-]?[0-9]" ~murray.saulosl640/uli101tutorial9/numbers.txt</span><br> &nbsp; &nbsp;(Why?)<br>4. <span style="font-family:courier;font-weight:bold">egrep "^[+-]?[0-9]" ~murray.saulosl640/uli101tutorial9/numbers.txt</span><br>5. <span style="font-family:courier;font-weight:bold">egrep "^[+-]?[0-9]+$" ~murray.saulosl640/uli101tutorial9/numbers.txt</span><br>6. <span style="font-family:courier;font-weight:bold">egrep "^[+-]?[0-9]+[.]?[0-9]+$" ~murray.saulosl640/uli101tutorial9/numbers.txt</span><br>
11. Write a Linux command to display all lines in the file called '''~/data.txt''' that begins with a minimum of 2 occurrences<br> &nbsp; &nbsp; &nbsp; and a maximum of 4 occurrences of the word “the” or the word “but” (upper or lower case).
 
 
 
[[Category:OSL640]]