Changes

Jump to: navigation, search

Tutorial9: Regular Expressions

396 bytes added, 14:26, 2 September 2020
LINUX PRACTICE QUESTIONS
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 plym ~murray.saul/uli101/cars</span>
2. <span style="font-family:courier;font-weight:bold">grep -i fury ~murray.saul/uli101/cars</span>
3. <span style="font-family:courier;font-weight:bold">grep “^[m-z]” ~murray.saul/uli101/cars</span>
4. <span style="font-family:courier;font-weight:bold">grep -i “^[m-z]” ~murray.saul/uli101/cars</span>
5. <span style="font-family:courier;font-weight:bold">grep “3$” ~murray.saul/uli101/cars</span>
6. <span style="font-family:courier;font-weight:bold">grep -i “c.*5$” ~murray.saul/uli101/cars</span>
7. Write a Linux command to display all lines in the file called '''~/text.txt ''' that contains the pattern:
the
8. Write a Linux command to display all lines in the file called '''~/text.txt ''' that contains the word:
the
9. Write a Linux command to display all lines in the file called '''~/text.txt ''' that begin with a number.
10. Write a Linux command to display all lines in the file called '''~/text.txt ''' that end with a letter
(either upper or lowercase).
11. Write a Linux command to display all lines in the file called '''~/text.txt ''' that begin and end with a number.
12. Write a Linux command to display all lines in the file called '''~/text.txt ''' that contains exactly 3 characters that can be anything.
13. Write a Linux command to display all lines in the file called '''~/text.txt ''' that contains exactly 3 numbers.
14. Write a Linux command to display all lines in the file called '''~/text.txt ''' that contains 1 or more “C” characters.
13,420
edits

Navigation menu