Hacker News new | ask | show | jobs
by colineartheta 1907 days ago
Just curious (I agree with you), but what are the s/ and /g for? Samsung and Google?
7 comments

I think the OP is using the sed syntax [0] to say:

> Now rewrite your entire comment with sonos instead of ubiquiti.

[0] https://www.grymoire.com/Unix/Sed.html#uh-6

It is a `sed` command, used to replace (s/) all (/g) instances of the first word with the second.
Good tools support search and replace. Better tools support regular expressions.

https://linux.die.net/man/1/sed

It's how you do a text replacement in VIM, I believe it's s for substitute, /../ for the regular expression, and g for global, to substitute multiple instances.
Don't forget the % if you are using vim, to make sure you replace on all lines :)

:%s/ubiquity/sonos/g

That's the syntax for search on replace with sed on Linux.
“/s” stands for search and “/g” for “global” replace.