Post B5hWhMWKhco628YfB2 by tux0r@layer8.space
(DIR) More posts by tux0r@layer8.space
(DIR) Post #B5hUZzSppNOOadHMPo by aartaka@merveilles.town
0 likes, 1 repeats
So happy I get to write ed(1) scripts again. This time for my blog analysis. Yes, getting aggregate stats and making inferences about my site, all in the comfort of ed(1)!@ed1conf
(DIR) Post #B5hWhMWKhco628YfB2 by tux0r@layer8.space
0 likes, 0 repeats
@aartaka @ed1conf Probably portable to sam(1) scripts.
(DIR) Post #B5hWhMlDoGiUmJWYNs by aartaka@merveilles.town
0 likes, 0 repeats
@tux0r I doubt it, as sam(1) changed a lot of commands and moved to Structural Regular Expressions. Which is fine, but it's inferior to ed(1) portability and reliability.@ed1conf
(DIR) Post #B5hWhMxH5SMFNhABAe by tux0r@layer8.space
0 likes, 0 repeats
@aartaka @ed1conf ed(1) is portable if you use one ed(1) implementation. GNU ed <> BSD ed <> POSIX ed.
(DIR) Post #B5hWhNAkHN8K3TSwAS by ed1conf@bsd.network
0 likes, 0 repeats
@tux0r To be fair, there are some minor differences in implementations. Things like• the x command doing encryption in some versions (has been added-then-removed in some),• GNU ed no longer allowing the omission of trailing slashes in s commands like s/regex• GNU ed offering y to yank lines and x to put lines• GNU ed provides # for script comments, but that's rejected in the other versions I have availableIf you stick to POSIX, the only odd-one-out is the s/regex which GNU breaks (according to POSIX, "If the closing delimiter of an RE or of a replacement string (for example, '/' ) in a g, G, s, v, or V command would be the last character before a <newline>, that delimiter can be omitted" [emphasis mine])@aartakaedit: markdown ate less-than-sign
(DIR) Post #B5hXmL0hqQ9GkghXxg by aartaka@merveilles.town
0 likes, 0 repeats
@ed1conf @tux0r the closing delimiter thing is not POSIX, but it enables newline insertion in g et al., and also works on OpenBSD ed and slewsys ed (didn’t test on Mac.) So I’m ready to live with this consensus “standard.”
(DIR) Post #B5hXmLDT4yMBOGfjqy by ed1conf@bsd.network
0 likes, 0 repeats
@aartaka I quoted the POSIX bit that states it should be optional, so in compliant versions like BSD ed :s/patternit works fine, and I use it all the time. But in GNU ed it complains:s/pattern ? h Missing pattern delimiterA personal pet peeve when that broke (around 1.14 IIRC :flan_angry: )@tux0r
(DIR) Post #B5hYws1a3Nt1zehFAG by ed1conf@bsd.network
0 likes, 0 repeats
@aartaka I've heard the newline-in-g is the reason GNU made the change, but it works as expected in BSD ed without breakage:g/interesting/s/splithere/before\ afterworks fine, and if I want other commands, I can add them by explicitly including the delimiter:g/interesting/s/splithere/before\ after/\ -s/.*/[&]So GNU broke something specified by POSIX that I used regularly, in the name of fixing something that was never broken, and it makes me a spot grumpy :flan_XD:@tux0r