|
thanks i hate it
|
# ? Mar 7, 2024 14:51 |
|
|
# ? May 15, 2024 04:22 |
|
rjmccall posted:i wasn’t aware awk had that kind of math processing at all as far as i am aware, if you want to do non-integer arithmetic in a shell script, the most portable way by far is to invoke awk with your expression; dc and bc aren't available in nearly as many places as some version of awk as for why you'd need to do that sort of thing in a shell script,
|
# ? Mar 7, 2024 15:25 |
|
during the pandemic I taught this class that used a bunch of unix primitives to introduce systems primitives to second-year CS majors and I'm convinced my greatest coup was tossing out the original "this is a class on stupid bash tricks and re-implementing first year CS assignments in perl" curriculum to pad the back half of the class with awk not least because once you see that awk lets you open a socket by opening a pseudofile in /inet/tcp/ you've already motivated discussion on plan9
|
# ? Mar 7, 2024 15:53 |
|
pseudorandom name posted:its so you can include the version string in bug reports op yeah they probably got bit by bugs in bad versions that linux distributions yolo'd in there and never bothered to in any way test, and of course never update either
|
# ? Mar 7, 2024 16:30 |
|
Internet Janitor posted:as for why you'd need to do that sort of thing in a shell script, I’ve used it to add up elapsed times, or give an average time, IIRC. maybe I just dreamed that
|
# ? Mar 7, 2024 16:41 |
|
MononcQc posted:Awk's variables are hosed up, but the workaround for them is hilarious: if you declare a variable as a function parameter, it won't share a scope with the parent callers; also if you declare a variable as a function parameter and it is not put in by the caller, it's gonna be uninitialized. Therefore, declare your local-scoped variables as function parameters. Here's a snippet from some code I wrote when doing the 2021 advent of code with Awk (up until day 14): Here's a vastly better awk tutorial that takes only 5 seconds: sudo rm `which awk`
|
# ? Mar 7, 2024 17:18 |
|
I use awk and all of its power to exclusively use it in the same way cut is used.
|
# ? Mar 7, 2024 17:43 |
|
Soricidus posted:I don’t really understand the need to learn advanced awk stuff when perl is right there out of the box too on most unices (and way more portable), but I respect people who do it anyway To give a serious answer, it's available but not always installed on Linux. Like, kernel and stuff need it to build, but it's not present on base installs of e.g., Fedora. Minimization people get pissy when it's your package that's dragging in a whole language into the minimal system, even if basically anything the user installs would drag it in. (And of course perl has the whole "write-only" stigma attached, deservedly or no, while awk doesn't.)
|
# ? Mar 7, 2024 17:44 |
|
Zlodo posted:Here's a vastly better awk tutorial that takes only 5 seconds: shouldnt you use alternatives and xargs to get all of them?
|
# ? Mar 7, 2024 18:01 |
|
leper khan posted:shouldnt you use alternatives and xargs to get all of them? If awk still unfortunately works just run the command again
|
# ? Mar 7, 2024 18:02 |
|
nobody has ever seriously considered making a package manager for "awk libraries" or "awk frameworks" with the exception of the usual GNU extensions traps, there's no dependency hell you just write programs as one file in terms of the functionality awk gives you out of the box this is an underappreciated virtue
|
# ? Mar 7, 2024 18:38 |
|
FlapYoJacks posted:I use awk and all of its power to exclusively use it in the same way cut is used. awk is better than cut because it collapses multiple spaces into one
|
# ? Mar 7, 2024 18:43 |
|
I really love awk for quick text processing tasks. Not having real csv support until 2023 (and I dont think gnu awk has it yet?) sucked but I think I'll use it more now
|
# ? Mar 7, 2024 19:37 |
|
csv support? does it handle quoted newlines?
|
# ? Mar 7, 2024 19:40 |
|
Internet Janitor posted:nobody has ever seriously considered making a package manager for "awk libraries" or "awk frameworks" Yes its very easy to toss a small self contained package in the trash
|
# ? Mar 7, 2024 19:42 |
|
DELETE CASCADE posted:csv support? does it handle quoted newlines? Yeah https://github.com/onetrueawk/awk?tab=readme-ov-file#csv
|
# ? Mar 7, 2024 19:50 |
|
dope af, wouldn't have expected that from a line-oriented (ok ok record-oriented) tool like awk
|
# ? Mar 7, 2024 19:53 |
|
if I was the maintainer of awk I'd call myself the awkwarden
|
# ? Mar 7, 2024 20:12 |
|
pokeyman posted:if I was the maintainer of awk I'd call myself the awkwarden lol
|
# ? Mar 7, 2024 20:35 |
|
awk is wak
|
# ? Mar 7, 2024 20:39 |
|
rawk out with your awk out
|
# ? Mar 7, 2024 20:41 |
|
Dijkstracula posted:not least because once you see that awk lets you open a socket by opening a pseudofile in /inet/tcp/ you've already motivated discussion on plan9 and you would desire that why?
|
# ? Mar 7, 2024 21:38 |
|
eschaton posted:and you would desire that why? everything is a file
|
# ? Mar 7, 2024 22:08 |
|
is awk web scale
|
# ? Mar 8, 2024 01:16 |
|
Bloody posted:is awk web scale yes, but you'll want to containerize it so it uses consistent versions of the various math libraries it depends on
|
# ? Mar 8, 2024 01:30 |
|
hmm. I’m a total sicko for jq and yq. maybe I should learn awk.
|
# ? Mar 8, 2024 01:34 |
|
prisoner of waffles posted:hmm. I’m a total sicko for jq and yq. maybe I should learn awk.
|
# ? Mar 8, 2024 02:14 |
|
if i could change one thing about awk i think i'd make associative arrays first-class values it would definitely complicate the implementation, though
|
# ? Mar 8, 2024 02:28 |
|
if you were going to do that you would instead just `python -c`. just learn awk, its good and useful, and will save you from creating the n+1th dumb CLI tool at your organization
|
# ? Mar 8, 2024 02:29 |
|
Internet Janitor posted:if i could change one thing about awk i think i'd make associative arrays first-class values I jest, of course, but I also love Lua, and honestly, after you move past what awk is good at, I want to make the claim that Lua should be your next stop on the complexity train for CLI-style text processing, if just for tables, patterns, and (if necessary) LPeg. I realize this is a bold take given Perl exists and my invocation of Lua will return us to the debates about 0- versus 1-indexing, but like eternal return, we have closed the circle, the circle of life. Hakuna matata.
|
# ? Mar 8, 2024 02:40 |
|
well obviously when i have to do that sort of thing i use lil because, like many people who choose to post in the p-lang thread, i already have my own bespoke scripting language i was only speaking hypothetically; adding new features to a fork of awk wouldn't result in them being available in all the places awk already is, so it wouldn't confer any benefit over installing your choice of general-purpose scripting language
|
# ? Mar 8, 2024 02:44 |
|
Internet Janitor posted:well obviously when i have to do that sort of thing i use lil because, like many people who choose to post in the p-lang thread, i already have my own bespoke scripting language In sum: when I get past awk, I reach for Lua, even though I could do things in Python or whatever, because I like Lua for that job, and I think it does it well, despite not really being thought of much in the same class as Perl. Python in some ways has ate the world for now, so of course it could and can do this too.
|
# ? Mar 8, 2024 02:49 |
|
i think the programming world would be a much better place if lua had beaten python to the punch with respect to notebooks and scientific computing lua has some warts, but on the whole it's a tremendously simpler, more coherent, and more flexible language than python
|
# ? Mar 8, 2024 02:55 |
|
Torch tried…
|
# ? Mar 8, 2024 02:58 |
|
Internet Janitor posted:i think the programming world would be a much better place if lua had beaten python to the punch with respect to notebooks and scientific computing the language is never the source of the infinite complexity. if a million scientists wrote poo poo scientist code in lua that would be the nexus of infinite complexity
|
# ? Mar 8, 2024 03:03 |
|
both python itself and the python ecosystem are extremely hairy and heterogenous if scientists wrote millions of lines of bad lua it would still be less terrible than millions of lines of bad python because lua can get non-dogshit performance without punting everything to c
|
# ? Mar 8, 2024 03:09 |
|
fortran can also do that and yet its terrible
|
# ? Mar 8, 2024 03:14 |
|
BobHoward posted:there should be no legal or technical barrier to someone else doing a rosetta equivalent on their arm64 system, and i wouldn't be surprised to see it done in windows on qualcomm's upcoming high performance WoA SoCs Huh, is Windows on ARM still trying to be a thing then? It faceplanted in mobile phones and I didn't think Windows for Internet of Things got anywhere either. (if it is, well, I write a compiler for fun and it can a) do Windows and b) do ARM so...)
|
# ? Mar 8, 2024 13:39 |
|
BobHoward posted:there should be no legal or technical barrier to someone else doing a rosetta equivalent on their arm64 system, and i wouldn't be surprised to see it done in windows on qualcomm's upcoming high performance WoA SoCs I'm kinda surprised microsoft didn't do this for Windows RT or at any point really.
|
# ? Mar 8, 2024 14:38 |
|
|
# ? May 15, 2024 04:22 |
|
feedmegin posted:Huh, is Windows on ARM still trying to be a thing then? It faceplanted in mobile phones and I didn't think Windows for Internet of Things got anywhere either. this time it's not phones or IoT, it's laptops and tablets and desktops running full windows 11 (not a hamstrung version) with a rosetta equivalent to run x86 software. microsoft's rosetta isn't as good, but i've heard it has made huge strides and is decent, if a bit limited by existing win-on-arm hardware as to that hardware, it's mostly microsoft with a few surface branded arm tablets and laptops, and even a mac mini like SFF desktop they sell as a dev kit. there's also a few other machines made by oems. so far it's been very niche since performance in existing non-apple arm SoCs just isn't competitive with x86. qualcomm's looking to change that
|
# ? Mar 8, 2024 14:40 |