In regular expressions, using grep, search for all the lines that end with the word "hack" (may be followed by some whitespace), in file test.txt?
Answer
grep 'hack *$' test.txt
^^ note the use of $, also note the " *" do count for whitespace
Question
In regular expressions, using grep, search for all the lines that end with the word "hack" (may be followed by some whitespace), in file test.txt?
Answer
?
Question
In regular expressions, using grep, search for all the lines that end with the word "hack" (may be followed by some whitespace), in file test.txt?
Answer
grep 'hack *$' test.txt
^^ note the use of $, also note the " *" do count for whitespace
If you want to change selection, open document below and click on "Move attachment"
5. Regular Expressions begins or ends with a certain string. The ^ character specifies the beginning of a line, and the $ character the end of the line. For example, ^The matches all lines that start with a The , and <span>hack$ matches all lines that end with hack , and '^ *The.*hack *$' matches all lines that begin with The and end with hack , even if there is whitespace at the beginning or end of the line. B
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.