Search code examples
unixcommandnode-webkit

What does this command do


I have nw executable file...

sed -i 's/udev\.so\.0/udev.so.1/g' nw

the Node-webkit application binary.

I am running ubuntu 14.04Lts i tried to open nw with ./nw. i doesn't open.

After that i typed in the above command. It started working.

I am too curious to know what that command did to my executable.

I know sed is for matching file patters with regular expression. how can it operate on .exe (application/x-executable) file.

Please anyone explain.


Solution

  • The sed command that you've used searches the nw executable file (like an ordinary text file imagine) for any occurrence of the string udev.so.0 and substitutes it with udev.so.1. The backslashes \. before the dots are just for escaping the . character, which is a special character for sed (it means any character - a wildcard like * is on windows systems). The g character at the end of your command denotes also to continue searching a specific line, even if a first occurrence has been already found. This way the whole file - nw here - is being searched and replaced.