You are working on a documentation file userNotes.txt with some members of your
ID: 3754298 • Letter: Y
Question
You are working on a documentation file userNotes.txt with some members of your software development team. Just before the file needs to be submitted, you manager tells you that a company standard requires that two blank spaces be left between the end-of-sentence period (.) and the start of the next sentence. (This rule does not affect sentences at the very end of a line.)
Asking around among your team members, you discover that some of them have already typed their sentences in the approved manner, but others have inserted only a single blank between sentences.
You need to fix this fast, and the first thing you want to do is to find out how bad the problem is.
What command would you give to list all lines of userNotes.txt that contain sentence endings with only one blank before the start of the next sentence?
What command would you give to print (display on the screen) the corrected text of userNotes.txt with all sentence endings having required two blanks before the start of the next sentence?
Lenux
hint use Grep command and keep it simple
For example, this is OK: Turn the knob. Push the “on” button. This is not: Turn the knob. Push the “on” button.Explanation / Answer
1) grep -v 's ' userNotes.txt (Lists everything that has a single blank between sentences => -v is used to list everything that does not match the pattern specified)
2) grep 's ' userNotes.txt (Lists everything that is correct => cat opens the text file and grep looks for the pattern specified s (space))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.