bash - How can I match a string with brackets and apostrophes in sed? -


I am trying to match and replace the following string:

  & lt ;% = Host_env% & Gt; & Lt;% = host_entant_id% & gt; & Lt;% = domain_name% & gt; / & Lt;% = products ['as'] ['server_context_worker']%>  

Any ideas? I have tried:

  & lt;% = host_env% & gt; & Lt;% = host_entant_id% & gt; \. & Lt;% = domain_name% & gt; \ '\' ['Server_context_worker' \]% & gt; as \ / & lt;% = products \ ['  

And there are many differences in it, but I have not had any success.

You can use class squares (i.e. square brackets themselves) in sed Can match the bracket. In your example, you can do this:

  $ sed -e's / [[] * []] / {Something new} / '& lt; Sedbrackets.txt & lt;% = host_env% & gt; & Lt;% = host_entant_id% & gt; & Lt;% = domain_name% & gt; / & Lt;% = Products {Something New}% & gt;  

Leave a comment if it is not the replacement you are looking for. This was not a little clear from your question. Of course you can use them as many times as your choice, I have them once . * used as an example.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -