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

sed has regular expressions. I think you could do some binary arithmetic fairly easily with regular expressions and find and replace...


Yep, that's pretty much how you have to do it. (If all you need is increment/decrement, though, you can actually do it pretty concisely with decimal-digit strings. Skipping the binary-to-decimal conversion greatly simplifies displaying numerical values.)


The GNU sed manual has examples like that at the end. It always seemed odd to show examples of things that are so awkward and inefficient. If they meant for sed to do those things, presumably they would have made commands for them.


> to show examples of things that are so awkward and inefficient


Yeah. As in, better done in awk. The opposite of awkward is sedward.




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

Search: