Multiple choice technology operating systems

In vi if we want to replace any string e.g. "NAME" with "name" from line number 1 to 10 only, what command we can use?

  1. :%s/NAME/name/

  2. :1-10s/NAME/name/

  3. :1,10s/NAME/name/

  4. :s/NAME/name/

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In vi/vim, line ranges are specified using a comma separator, so :1,10s/NAME/name/ correctly substitutes the string on lines 1 through 10. Using % affects the entire file, omitting the range affects only the current line, and :1-10s is invalid syntax.