Deutsch English Français Italiano |
<20241220184059.820@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.unix.shell Subject: Re: a sed question Date: Sat, 21 Dec 2024 03:09:57 -0000 (UTC) Organization: A noiseless patient Spider Lines: 59 Message-ID: <20241220184059.820@kylheku.com> References: <874j304vv3.fsf@example.com> <lshab3Fk6t3U1@mid.individual.net> <87wmfv27yy.fsf@example.com> <lsjtj8F2r8aU1@mid.individual.net> <vk3orv$1ut71$1@news.xmission.com> <lsmfo5Ffor3U1@mid.individual.net> Injection-Date: Sat, 21 Dec 2024 04:09:58 +0100 (CET) Injection-Info: dont-email.me; posting-host="d5d1b111c2999b7691ff2176d531f326"; logging-data="3934889"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LPfFUhjqrsY4rKt0O8iBQ/bGbqxfQ3co=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:gs8+KwSM8rEmrh6hR983i9k62pY= Bytes: 4142 On 2024-12-21, Ralf Damaschke <rwspam@gmx.de> wrote: > Kenny McCormack schrieb: > >> Isn't this about the time where we give the caution about "Don't use sed >> for anything beyond the s/foo/bar/g stage" ? > > Simply because you cannot imagine how to use it? No! He explained the "because", in the immediately following text that you snipped: KMC> Seriously, the above looks like gobbledegook compared to the equivalent in KMC> AWK (or some other normal scripting langugae). "sed" looks like Intercal KMC> (once you get beyond s/foo/bar/g). KMC> I'm sure that whatever it is that OP is trying to do, it could be easily KMC> translated to (say) AWK and look much nicer. The reasoning doesn't quite match up with the characterization "can't imagine how to use it". Kenny need not imagine; he has seen examples of how to use Sed in ways beyond s/x/y/g, and has the above remarks about that. Sed is one of the so-called "esolangs" which some people use for puzzling. For instance, here is a kind of Lisp interpreter written in Sed: https://github.com/shinh/sedlisp/blob/master/sedlisp.sed The goal of writing in sed is not to solve the problem, and to communicate with future users of the program so that they can adapt it to changing needs; the goal is to puzzle out what it takes to solve it in Sed, and to show: "Hey, look, I did this in Sed! Isn't it amazing? (And, by extension, aren't I?)" Just like the goal of solving a Sudoku isn't to get 9 digits in every row, colum and box. That's the ostensible goal within the puzzle. The actual goal of the puzzler is to engage in puzzle solving. The given text processing problem to be solved in Sed serves a similar purpose to the 9 digit constraint rules in Sudoku: it just creates the pretext for entertaining puzzle solving, and is not the actual goal. People looking for solutions in their production workflow do not want "hey, look, this can be done in Sed!" type stuff. While people /can/ ramp up on it and easily become proficient, the only ones ever to do so are going to be engineers looking to waste time on puzzles. Engineers not looking for puzzing won't ramp up on stuff like this because it provides no value outside of puzzing. For production work, you need a language which not only orchestrates the needed computation on the machine, but also captures the requirements in a way that communicates to people. Programming languages are a form of documentation! Nobody wants to write cryptic gobbledygook just for shits and giggles, only to then have to write an accompanying ream of boring to try to bring it up to the same communication standard that comes from just writing nothing but code in an expressive language. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca