eupolicy.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
This Mastodon server is a friendly and respectful discussion space for people working in areas related to EU policy. When you request to create an account, please tell us something about you.

Server stats:

206
active users

#awk

0 posts0 participants0 posts today
Continued thread

That #awk script is someone's fork of `guff` ("a plot(1) device") that I've carried around for a while. It takes in columns of numbers on stdin and spits out an SVG plot with reasonable defaults. Damned handy.

Replied in thread

@simontatham

Do you run a mile from almost all #awk variants? (-:

Those have an escaping deficiency (save perhaps BSD awk where -F takes a regular expression) that almost no-one seems to deal with.

Few people realize that /etc/fstab in #FreeBSD is actually vis(3)-encoded, meaning that whitespace can never occur as field data, however one must unvis each field to work correctly.

There is a very obscure hint to this at the foot of the fstab(5) manual page.

github.com/freebsd/freebsd-src

@ska

GitHubfreebsd-src/lib/libc/gen/fstab.c at main · freebsd/freebsd-srcThe FreeBSD src tree publish-only repository. Experimenting with 'simple' pull requests.... - freebsd/freebsd-src

I wrote some #awk to parse output from `show interface` on #Cisco IOS devices this evening as one does.

It expands the ~27 lines of dense text with multiple values on each line to be 68 discrete data points that can be worked with.

Hey #entr fans: are there any examples of a `$ENTR_STATUS_SCRIPT` script out in the wild, or any explanation for what this feature was meant to do? It seems like it could be useful, and I'm a huge fan of #awk, but I can't find anyone explaining what they do with it.

TIL that modifying NF in #awk has an instant effect, so if you do

$ echo a b c | awk '{while (NF){print $(NF--)}}'

the post-decrementing removes the entry before the variable gets accessed, resulting in it printing blanks, so instead you have to access the variable before doing the post-decrement:

$ echo a b c | awk '{while (NF){print $NF; NF--}}'

to print each item in reverse.

Which seems weird given what I understand about how post-decrement is *supposed* to work.

(HT: @drscriptt whose #awk sent me down this rabbit-hole of learning)

Replied to Tim Chase

@gumnos That didn't quite work, but I did get it to work.

Here's what I have:

awk -F. '{for (C=NF;C; C--){printf "%s.", $C}; printf "oid."}'

NF-1 was missing a component.

I also added curly braces around the 1st printf to make it more obvious what the for loop applied to.

I wasn't aware that the for loop only applied to the very next instruction. #TIL #AWK

Well I did a thing.

I created a #DNS zone; .oid, on my DNS server #OIDs.

I can now easily look up OID values with dig (et al.):

% dig +short txt 2.3.7.5.5.1.6.3.1.oid.

To look up OIS 1.3.6.1.5.5.7.3.2.

I also wrote a one* line shell script to make doing the lookups easier:

\dig +short txt $(echo ${1} | awk -F. '{for (C=NF; C>1; C--){printf "%s.", $C}; printf "%s.oid.", $1}') | sed 's/"//g' #awk

So I can now run:

% oidlookup 1.3.6.1.5.5.7.3.2

and get the following output:

{iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) kp(3) id-kp-clientAuth(2)}

Enjoyed @kevlin on 'past and future of programming languages' yesterday. I am an outlier, I programmed in three languages outside the top 20 this week - #elixir, #lisp (emacs) and #awk (it comes bundled with most linux, and I have it on mac as well). Strangely enough, a local #llm makes the latter two more approachable. qwen3:30 is quite good at generating awk, and good enough to get almost-working #emacs lisp.

Hey beloved #noGooMe users,

A quick reminder that you *must* have the proxy image option unchecked when using this #SearxNG instance. It can be disabled, if you previously had it enabled, browsing to /preferences, then selecting the "privacy" tab and uncheck the "image proxy" switch.

It is disabled by default so any first connection to this instance has the proper setting set up.

If you do have it enabled, you’ll quickly be blocked at the firewall level by our #awk AI agent 🤖

My reason for disabling this feature is that it generates loads of requests from the instance IP to the external engines. And this makes those block us really fast.

This means that the engines will have *your IP* logged when you search for images, only. Classical text search are still masqueraded with our instance IP.

I still can't believe that most programming systems we use today are preoccupied with numbers. AFAIK, half of (R5RS?) #Scheme standard is numbers and operations on them. Same for #C, #CommonLisp, #Java—ten different types of numbers and huge libraries for them.

Humans think in images and words. Structured text-oriented languages feel like a much better fit for everyone not corrupted by C. Yet we have little to no popular attempts in that space. Structured Regular Expressions didn't catch up; #ed1 and #awk are considered mere #regex automation tools. Modal and the term rewriting systems have their Merveilles Town, but not much beyond. sh/#bash and the like are quite successful, but aren't considered real programming languages either.

Why.

Replied in thread

@ics

For me, it was during a lull in my workload at the #IBM Hursley lab in the UK when I worked my way through the O'Reilly #sed & #awk book (the one with the two lorises on the cover).

I'm guessing it was 1995 because my annual birdwatching summary at the start of the next year switched from a fixed column text document to formatting in #Postscript. My first big awk project was to process the underlying data to generate a PS document (something I also learned in the same downtime period).