3 ms·
S/Sed/Ed
- sedatk 2y agovi was originally the visual-by-default run mode of ed. And EDLIN on MS-DOS (and maybe CP/M too? don't remember) was based on ed too. That's why EDLIN and vi have similar command sets.
- susam 2y agoIf I remember correctly, vi was the visual mode of ex. I am trying to find some references for this. Here's one I could find from <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/v...>: > While ex and vi have historically been implemented as a single utility, this is not required by POSIX.1-2017. Better references would be very welcome. By the way, we can see this even today. For example, first type the following command in your terminal: ex Then at the ex prompt (the colon prompt), type this: vi This should bring up full blown Vim. The reverse is possible too. For example, in Vim, type: Q This takes us to Ex mode. Then in Ex mode type: vi This brings back Vim again.
- guerrilla 2y ago> If I remember correctly, vi was the visual mode of ex. This is correct. https://ex-vi.sourceforge.net/ https://ex-vi.sourceforge.net/
- snvzz 2y agoTIL about Rosetta code[0]. And I can't help but wonder what the license of the code in the site is. If it isn't BSD0 or some similar attempt at preemptive public domain, what is even the point of such a thing. 0. https://rosettacode.org/wiki/Rosetta_Code https://rosettacode.org/wiki/Rosetta_Code
- jph 2y agoRosetta Code is a great resource and uses the GNU Free Documentation License 1.2.
- snvzz 2y agoI see this much, but that's not a code license; it is a documentation one.
- Y_Y 2y agoDon Knuth might tell you that code and documentation don't need to be different. More seriously you can easily imagine Rosetta Code as just a way of teaching something, without an expectation that you'll compile or run it. In other words it is documentation, the fact that some of it is also code isn't a problem.
- snvzz 2y agoWhy would anyone teach with code that cannot be used for legal reasons? Instead of solving simple, common problems in many programming languages so that nobody has to ever do so again, this seems to make programming harder by excluding such solutions from being used. So now you have to find work arounds in order to NOT use the simple solutions in Rosetta. This is so evil. Should be called the tower of babel of code, rather than the rosetta stone.
- Y_Y 2y ago> Why would anyone teach with code that cannot be used for legal reasons? Ask the Numerical Recipes guys! But for real, you can use this code, I don't think anyone said that you couldn't.
- snvzz 2y ago>you can use this code No, you absolutely cannot. This is how copyright works by default. You'd need to relicense your code, with the permission of anyone else who owns copyright to it, to this documentation license.
- wisenull 2y agoRosetta Code is hosted on Miraheze. By clicking on Terms of Use at the bottom of any page you can see that the default for any wiki hosted by them is Creative Commons Attribution-ShareAlike 4.0 License: https://meta.miraheze.org/wiki/Terms_of_Use https://meta.miraheze.org/wiki/Terms_of_Use
- snvzz 2y agoCC-BY-SA would already be excessively restrictive for what are quite straightforward implementations of basic algorithms. But, literally the next string in that ToS: >Wiki owners can change this And they did. To FDL 1.2, a much less friendly license, in practice unusable.
- dextercd 2y agoOne time I used Power BI/Power query language to generate an Ed script that contained all versions of all XML documents in a database and turn them into a Git repo. I still like writing scripts that generate Git repos but I don't use Ed much.
- snthpy 2y agoDo you have anything public on this or similar to this? I'm also a fan of Power Query and M-lang and think it's underappreciated by the dev community. Why did you use PQ in that instance?
- dextercd 2y agoI don't have anything public, unfortunately. It wasn't super complicated. It just generated a long string of all the files with Ed commands around it to change the current file name (f) and invoke Git (!git). I don't remember why I decided to do it this way. I probably couldn't easily connect to the database any other way. Getting the right tools installed might've involved some bureaucracy. Nowadays, I probably would've just dealt with that, but I didn't know at the time how important that janky solution would be to my work. Power BI is not something I miss working with but Power Query is really nice. The fact that the UI generates code that you can tweak afterwards is a great learning tool. I still use it in Excel sometimes.
- xg15 2y ago> No. I stay with ed, because it is Forgot the most important point there. ...the standard text editor
- McUsr 2y agoUsing ed interactively, so you can work out some complex operation step by step, is a valid point for using ed instead of sed. Sometimes however, awk is the correct solution. (Why sit and mess with it, if awk provides a straight forward solution.)
- sgarland 2y agoAgreed, though you have to be careful not to rely on gawk (or mawk, etc.) specific features. To be fair, the exact same problem exists between sed and gsed. I always install gnu-utils on Macs because I find them to be easier, but if I need to share with coworkers, I have to go back and ensure they’re portable.
- riedel 2y agoActually interactive editing with ed saved my ass once on my FreeBSD server once. Somehow, my terminal driver (actually I actually used my vt520 even for emails at the time) was totally broken so I only had a single line. I actually managed to edit the settings file with ed to get things straight and do a reboot. However, if you know sed you should be able to handle. However, this was 2001 or so and I somehow doubt that I it will happen again ...
- sherburt3 2y agoI love me some sed but using that ed syntax to do anything more complex than straightforward regex substitutions makes me feel like a chimpanzee trying jam a square peg into a round hole.
- danielbln 2y agoThis is me trying to use jq for anything remotely complex. At least LLMs took the pain out somewhat.
- msephton 2y agoCapitalisation really didn't help with this title.
- layer8 2y ago> Hey, I'm looping for work. Freudian slip? ;)
- gregjor 2y agoI used ed for actual work decades ago, on a VT-100. My first job. We all used it until we got vi on the DECSystem-20. When people look at ed now it seems unusable. Back in the old days we had a printed copy of the code, with line numbers. We annotated the printed copy, then made edits. That made using a line-oriented editor a lot less painful. I haven’t seen programmers looking at code on paper in a long time.