Jump to content

Replace all strings with vi

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Prog

Prog

    Learning Programmer

  • Members
  • PipPipPip
  • 98 posts
Is there a way in vi to replace all occurrences of a string with another string? Such as:

DEPAR with DEPARTMENT

??

#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
This works in Vim, but I think it'll work in Vi too.
:%s/DEPAR/DEPARTMENT/g


#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
v0id's suggestion works on vim as well as vi. Most Linux systems now use an alias for vi and actually execute vim when you type vi. After all, vim is only vi improved.