I am trying to find the proper regexes to use with the grep command on the file text.txt.
Question
Find all occurrences of words in text that have a substring ad, bd, cd, dd, ed.
Find all occurrences of numbers > 100
Find all occurrences of numbers > 100 that contain a digit 0 or 5
My Approach
grep -io '[a-e]*d' textPrints words with the proper substrings, but doesn’t print the whole string/word.
ad d d ed d d ed d d d d ed d dgrep -io '[199][1-9]*' textI believe I am way off on the regex, but it still prints the correct result.
1973 197 17775grep -io '[05][1-9]*' textThis is the continuation of 2., so I don’t understand the 2. part in 3., but I believe I have the string containing a digit 0 or 5 correct.
0 0 0 5
-oonly prints the bit that matched so if you need more than the pattern you have you need to extend it to match the words/etc. you need.