regex - find and replace line sed older version -


I am trying to find and replace a port number in a server file (because all my partners are of the same server ), So we need different ports ... I was trying to use it: sed -i -e '/ var port./var port = 3000; / 'Server.js to change the port from 5000 to 3000. The acetal line of code i var port = 5000; I am trying to change the file in server.js when I try to do it on our RAL server (which I do not want to get this message sent to sed: -e expression # 1, four 14: Need a new version of sed

Am I not using the correct regex? Or is this making the server inconvenient?

< Div class = "post-text" itemprop = "text">

If you are trying to search and replace, start the command with s Forget it, also, -e is not necessary (but it should not be the cause of any problem). In-place revision of earlier versions of sed , So you should overwrite the file yourself:

  sed 's / var port. * / Var port = 3000; /' server.js & gt; tmp & amp; ; Mv tmp server.js  

It may be necessary to make regular expressions more specific, but this rests on the contents of the rest file


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -