Multiple choice technology programming languages

16.) To delete all the trailing spaces of each line of file test1

  1. a) sed 's/[ ][^ ]*$//' test2
  2. b) sed 's/[ ][ ]*$//' test2
  3. c) sed 's/[ ][ ]*$/' test2
  4. d) sed 's/[ ][ $]*$//' test2
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The sed command sed 's/[ ][^ ]*$//' matches a space followed by any non-space characters at the end of a line and removes them, effectively stripping trailing spaces from each line of the file.