0

I've tried searching the web but the phrases are too general or I didn't know what to search for. If I use /(some IP address) in vi I know I can simply enter / (Enter) again and find the next occurrence. What I'm wanting to do is retrieve the previously entered IP address, edit it (since I'm searching for similar IP addresses) and search for the edited IP address. Is there a way to do this? Thanks for your help.

2 Answers2

2

Have you tried up/down arrows for that? '/' then up give you opportunity to go through history of searches even in other files.

kab00m
  • 398
  • 1
  • 9
0

You can use n to search for the next entry that matches / and you can use Shift-n to search for previous entries that are the same.

If you're changing all the entries that match you could use the following in interactive mode:

:1,$s/<ip address>/<new ip address>/g
kenlukas
  • 2,886
  • 2
  • 14
  • 25