0

I would like to find number of match result with http://localhost:8080/MyProject/jsps/ErrorPage.jsp Incident ID in vi editor? How to do this?

i tried :%s/http://localhost:8080/MyProject/jsps/ErrorPage.jsp Incident ID/&/gn but it shows error E488: Trailing characters

2 Answers 2

1

This is because you have the separator / in the word you are looking for, so that the blocks get confused.

You can escape all the /, but it can be faster and cleaner to change the separator. For example, you can use _:

:%s_http://localhost:8080/MyProject/jsps/ErrorPage.jsp_&_gn
   ^                                                  ^ ^
0
1

the syntax should be like below,

%s/http:\/\/localhost\:8080\/MyProject\/jsps\/ErrorPage.jsp\ Incident\ ID/&/gn

Note: you need to always scape "/, space"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.