What will be the result of this command?

You have opened file1 in the vi editor. The contents of file1 is shown below:
[root@server1 ~]# vi file1
green
red
pink
blue green pink
white green blue green
blue green pink green
At the vi editor command mode, you execute the following command to edit the contents of file 1:
:1,$s/green/yellow/
What will be the result of this command?

You have opened file1 in the vi editor. The contents of file1 is shown below:
[root@server1 ~]# vi file1
green
red
pink
blue green pink
white green blue green
blue green pink green
At the vi editor command mode, you execute the following command to edit the contents of file 1:
:1,$s/green/yellow/
What will be the result of this command?

A.
It will search only the first line for all occurrences of the regex green and replace it with the word
yellow.

B.
It will search the entire file for the first occurrence of the regex green and replace it with the
word yellow.

C.
It will search only the first line for the first occurrence of the regex green and replace it with the
word yellow.

D.
It will search the entire file for all occurrences of the regular expression (regex) green and
replace it with the word yellow.

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *