Find the answer to your Linux question:
Results 1 to 3 of 3
I want to replace some entries in an -x file. The problem is the enties have a "/" in them. And as we all know the replace uses the "/" ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    141

    vi replace..pls read


    I want to replace some entries in an -x file. The problem is the enties have a "/" in them. And as we all know the replace uses the "/" as the delimiter(for lack of a better term).
    So how do I include / in the replace argument>
    In case I haven't explained myself here is an example:

    aaa/bbb/ccc -> xxx/yyy/zzz
    thanks
    Mace

  2. #2
    Linux User Giles's Avatar
    Join Date
    May 2005
    Location
    Gloucestershire and Cambridge, UK
    Posts
    283
    You can just change the delimeter from the forward slash to an apostrophe, so you'd be after something like
    Code:
    :%s'aaa/bbb/ccc'xxx/yyy/zzz'g
    (At least, that works in vim, I haven't tried in plain old vi )

    HTH
    Giles
    "Our greatest fear is not that we are powerless. Our greatest fear is Microsoft"
    Registered linux user #391027

  3. #3
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    141
    worked like a champ
    thank you very much
    mace

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •