skip to Main Content

I need to change some words in bulk, but because of the brackets inside it, I think I do something wrong.

Line that needs to be changed

echo "CMD_PLUGINS_ADMIN/admin/index.html";

I need to change it to this:

echo "CMD_PLUGINS_ADMIN/reseller/index.html";

I tried it with: sed -ie 's/admin/reseller/' *

But does not change anything, I hope someone knows the right command for it.

2

Answers


  1. $ echo '"CMD_PLUGINS_ADMIN/admin/index.html";' | sed 's//admin///reseller//g'
    "CMD_PLUGINS_ADMIN/reseller/index.html";
    
    Login or Signup to reply.
  2. your input has slash and you are using slash as sed seperator
    Either escape the slashes in input by preceeding them with backslash:

    echo '"CMD_PLUGINS_ADMIN/admin/index.html";' | sed 's//admin///reseller//g'
    "CMD_PLUGINS_ADMIN/reseller/index.html";
    

    OR change seperator to any other like pipe:

    echo '"CMD_PLUGINS_ADMIN/admin/index.html";' | sed 's|admin|reseller|g'
    "CMD_PLUGINS_ADMIN/reseller/index.html";
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search