Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create sed regular expressions that satisify the following • No more than one sp

ID: 3756999 • Letter: C

Question

Create sed regular expressions that satisify the following

• No more than one space between tokens.
• No trailing whitespace after a line.
• Binary operators should always surrounded by a single space on either side (including assignment and Boolean). Only the following operators must be accounted for: +, -, *, /, =, ==, <=, >=, <, >.
• Conditions should not have whitespace immediately inside of the parentheses.
• The program should not modify spaces which are leading, expanded tabs.
• Comments should be left alone. You may assume comments (single- and multi-line) will not appear on lines with source code

Explanation / Answer

Ans 1-sed -E 's/ s[a-zA-Z]s//g'

Ans 2- sed -E 's/.s /. /g'

Ans 3- sed -E 's/[ +, -, *, /, =, ==, <=, >=, <, >]s//g'

Ans 4- sed -E 's/{s/{/g'

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote