Which command is used with vi editor to search a pattern in the forward direction? A. / B. ? C. // D. ?? E. None of the above

/
?
//
?? E. None of the above

The correct answer is A.

The / command is used to search for a pattern in the forward direction. For example, if you want to search for the word “hello” in the current file, you would type /hello and then press Enter. The vi editor will then search for the word “hello” and highlight it.

The ? command is used to search for a pattern in the reverse direction. For example, if you want to search for the word “hello” from the end of the current file, you would type ?hello and then press Enter. The vi editor will then search for the word “hello” and highlight it, starting from the end of the file.

The // command is used to search for a pattern in the current line. For example, if you want to search for the word “hello” in the current line, you would type //hello and then press Enter. The vi editor will then search for the word “hello” and highlight it, only in the current line.

The ?? command is not a valid vi command.

Exit mobile version