ULI101 – Quiz 2-1
Student term: ______________________________________
ULI101 Section: _______________
This to discover is worth installment payments on your 5% of the course class.
Maximum time allowed can be 20 minutes.
View the sample test file
Provide grep commands in line with the following requirements, working with folders called
'input'. With the exception of query #12, all questions are well worth 2 marks.
1 . Display all lines that are accurately 5 characters long:
grep " ^..... $” insight more elegant method to find a type of ‘n' heroes is grep –E " ^. n $” type or
grep " ^. \ n\ $” input (Must ‘escape' and with \) or work with egrep instead of grep –E
2 . Screen all lines that have for least 1 letter 'o' in them, upper- or lower-case:
grep –i " o” input or grep "[oO]” suggestions
3. Screen all lines with line 'or' and then an 'ate' anywhere there after:
grep " or. *ate” input
5. Show almost all lines which often not begin with a lower-case letter:
grep " ^[^a-z]” input grep –v " ^[a-z]” will show blank lines as well
5. Display almost all lines that do not have two letters 'r' following the other person:
grep –v " rr” input
6. Count all empty lines:
grep –c " ^$” insight
7. Present all lines that end with a comma followed by a single digit:
grep ",[0-9]$” insight
8. Display all lines that contain a great asterisk (*):
grep " \*” input
9. Display lines which contain a phone number (for example: 647-555-1234):
grep –E "[0-9]3 -[0-9]3 -[0-9]4 ” input (if you use grep without –E you will have to ‘escape' similar to Q1)
10. (3 marks) Show lines containing figures with a decimal point (for ex.: twenty-three. 123):
TODAY, THIS ONE IS TOUGH WHENEVER YOU HAVE TO MAKE USE OF EITHER –E OPTION OR PERHAPS egrep. You gathered that n means
a repetition of n moments. If you put n,m it implies it repeats a minimum of ‘n' and the maximum of ‘m'
times. Finally, and that is that which we have to work with here to look for any fraccion number (Michal does not identify
the format), n, means that it repeats a...