Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And nobody seems to have mentioned the fact that to run this script you'll need to install node and npm (although you can argue that node comes with npm, but anyway…). You might as well just install GNU sed in BSD if that's the problem. Also, I believe GNU sed is much faster than any javascript script.

Moreover, if you want to use this as part of your node app, then it's a good reason to reimplement some of sed's functionality.

I still don't see why you'd laugh or ridicule someone else for doing something like this, and sharing it (if anything at all, it serves as a good tutorial on file manipulation with javascript/node IO.



"You might as well just install GNU sed in BSD if that's the problem"

Often not possible depending on what authorizations and hosting you have.


What are you talking about? Yes, GNU bloatware is massive and hideous, but it is still far easier to install than javascript + framework + package manager + package. If you don't have the ability to run binaries in ~/bin then you can't use this sed alternative either.


I took it that I already had node.js installed because that's what we were using. Asking for a replacement for an already existing sed is probably not going to happen.


You don't need to ask unless /home is mounted noexec. It seems rather absurd to assume a seldom used and rather massive ecosystem of language, libs, framework and package manager are installed, but that it is impossible to upload a copy of gsed to ~/bin. The number of shared hosting environments where you can't run your own code, and you already have node installed is miniscule.

And although its getting a bit off-topic at this point, doing replacements directly in the file isn't even a good idea. The standard "move $file to $file.backup, run sed against $file.backup and pipe it into $file" method is not just recommended because it is portable, it also saves your ass when you messed up your search+replace and broke all your files.


"You don't need to ask unless /home is mounted noexec."

You'd be surprised what is restricted in a lot of corps beyond the "approved" software list. It is amazing what big things get approved and what little things don't.


No I wouldn't, I've dealt with them extensively. I have no idea how that is relevant though. If Enterprositous Corp X needs a way to do replacements, they install one. They would have to install node and a ton of other crap anyways, why do you pretend installing a single trivial binary is beyond hope of possibility, but installing a huge language+framework ecosystem is totally cool?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: