Logo Background

SED Directory Path Change Using VI

  • By on February 12, 2009 | No Comments

    When you have one file in UNIX operating system that you want to change a string, you can use SED command to do so.

    The SED command is used to make global changes to strings in UNIX files.  For example, below we have a utility that will change all strings in a directory from one string to another.

    Example, the string that you want to replace was from “/live/prod” to “/test/dev” so you have to execute the command as below: –

    :%s;/live/prod/;/test/dev;g

    This command should be execute when you open the file using VI, and %s will perform a search and replace

    This is sort of a “change all” utility within UNIX, although is not SED but the slang was quite the same as SED.

    Double verify on the string that you replace before you perform any :wq! on the file

    Previous
    Next
    » Find, Search And Replace Files In UNIX
Leave a Comment