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

Overkill. Just use:

    $ sed -i 's,MY_NAME,Marco,g' *.txt


nope. I've dealt recently with some big DB files (I think GB size) and regex doing the same. sed is a lot slower than perl for this kind of task.


I don't know how sed and perl compare, but I know these things:

Use a C local (e.g. LANG=C or LC_ALL=C) for dramatic speed up of tools like grep/sort and probably also sed. If you don't do that, usually the UTF-8 parser kicks in, which is a lot slower.

Perl is actually well known to have a non-optimal regex implementation: https://swtch.com/~rsc/regexp/regexp1.html That said, I don't know how fast it is (what optimizations it has) at simple string substitutions.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: