52 comments
leetrout · 5 days ago
Related, `sd` is a great utility worth the install which makes simple sed-type operations more obvious / easier (for some value of easy).

https://github.com/chmln/sd

Show replies

qwertox · 5 days ago
> Why sed??

> Sed is the perfect programming language, especially for graph problems. It's plain and simple and doesn't clutter your screen with useless identifiers like if, for, while, or int. Furthermore since it doesn't have things like numbers, it's very simple to use.

"useless identifiers like if, for, while, or int"? Useless identifiers?

Show replies

ok123456 · 5 days ago
This is built into perl:

perl -MO=Deparse -w -naF: -le 'print $F[2]'

trey-jones · 5 days ago
Once in HN comments I saw `sed` referred to as a one-way hashing function, and that's always stuck with me - not just for sed, but for any type of operation that ends up being sort of a "black box". Input becomes output reliably, but it's hell to understand how. My big take away was: These types of operations are OK, when necessary, but it's a good idea to take the time to write some comments/documentation so the next person who looks at it (including self) has somewhere to start.

That said, debugging is definitely a thing, and tools like this are awesome!

mifydev · 5 days ago