Danny
Danny

Reputation: 5420

Using sed to find a folder directory in a file and replacing with another directory

So I am trying to use a simple sed command in shell to find and replace a certain string in my bash file for an alias.

The alias is something like:

alias configure='cd /opt/Test/conf/server'

I want to replace /opt/Test/conf/server with /opt/Test/conf but am having difficulties with the syntax.

Thanks for any help.

Upvotes: 1

Views: 242

Answers (1)

phlogratos
phlogratos

Reputation: 13924

cat my_bash_file.sh | sed 's#/opt/Test/conf/server#/opt/Test/conf#g'

Upvotes: 1

Related Questions