On migrating from Pocket, file conversions and link rot.
Learned a few things about #awk and #gawk and ended up picking #python to get it done.
https://tiagoafpereira.net/blog/posts/2025-06-04-migrating-from-pocket/
On migrating from Pocket, file conversions and link rot.
Learned a few things about #awk and #gawk and ended up picking #python to get it done.
https://tiagoafpereira.net/blog/posts/2025-06-04-migrating-from-pocket/
There are only 3 hours left to bid on #FreeSoftware #memorabilia! Bid now before time runs out: https://u.fsf.org/466 #FSF #FSF40 #GNU #Amiga3000UX #VT220 #TeX #Terminus-est #Savannah #gawk #lilypond #emacs
Assigning your copyright to the FSF helps defend the GPL and keep software free. Thanks to Ben Simms, Christian Ioneci, and David Masterson for assigning their copyright to the FSF! More at: https://u.fsf.org/463 #Emacs #gawk #CopyrightAssignments
Assigning your copyright to the FSF helps defend the GPL and keep software free. Thanks to Ben Simms, Christian Ioneci, and David Masterson for assigning their copyright to the FSF! More at: https://u.fsf.org/463 #Emacs #gawk #CopyrightAssignments
Assigning your copyright to the FSF helps defend the GPL and keep software free. Thanks to Ben Simms, Christian Ioneci, and David Masterson for assigning their copyright to the FSF! More at: https://u.fsf.org/463 #Emacs #gawk #CopyrightAssignments
把 APT 的 Legacy Format 轉成 DEB822
機器升級到 Ubuntu 24.04 後,/etc/apt 下面的預設格式都變成 DEB822 格式了,看起來在「[Spec] APT deb822 sources by default」這邊有討論。
舊有的格式還是會吃,但總是想翻掉,我依照我有遇到的 case (但不是所有 legacy format 的 case) 用 AWK 一行轉完:
gawk '{if ($1 ~ /^deb/) {prin
#Computer #Linux #Murmuring #OS #Programming #Software #apt #awk #deb822 #debian #format #gawk #legacy #linux #mawk #ubuntu
I taught myself a new programming language today: #gawk (#awk)
I'm pretty impressed at how clean and versatile it is.
Also, having a tutorial with very plain HTML-like layout and yellowish background helps enormously: https://www.grymoire.com/Unix/Awk.html
I recently learned that you can make multiple statements in awk/gawk, separating them by semicolons, like many decent programming languages. This makes it relatively easy to assign various attributes and functions on extracted text to produce final output. Yes, even with a custom field splitter.
Managing quotation marks is still tricky, though.
I gotta share! Example for illustrative purposes:
gawk -F’\t’ ‘{sub(“old-value”, “new-value”, $1); gsub(“ “, “-“, $2); match($1, /^[a-z]+/,newArray); newVariable = $2 “ new text ” newArray[1]; print “My changed output: “ newVariable;}’ input-file.txt
In this example I’ve specified a field separator (specifying the creation of $ numbered variables from input), used 3 functions (one creating an array variable), assigned a variable, and output text to the command line—with text from the given input file. Changing the “print” statement to a “system” function (i.e. system(newVariable)) lets you run your output as commands. So very handy.
Стилистический Анализатор: Синхронизация порядка объявлений и определений функций
У нас в организации есть обязательное правило оформления исходников, которое звучит так: Порядок объявления С-функций должен совпадать с порядком определения С-функций. В этом тексте представлен алгоритм работы консольной программы, которая автоматически выявляет нарушения этого странного правила.
https://habr.com/ru/articles/844436/
#ctags #awk #gawk #sed #cygwin #cmp #gcc #статический_анализ #стилистический_анализ #static_analysis
@mos_8502 these concerns actually were core requirements when I was looking for a real language to rewrite #inxi to. #bash + #gawk were used initially for similar reasons but were a nightmare to work with. One and only one language met the feature stability + robustness + trustworthiness criteria: #Perl
I liked the results enough to start using it for advanced work tools too. Then I spun up inxi dev tools in perl. My life is better now. Inxi runs on 20 year old os, and on 386 + #slackware 9
@racchio
To get more insight in what a script does, I sometimes do (with GNU awk AKA #gawk )
gawk --lint=$lintfile --dump-variables=$dumpfile --profile=$proffile ...
GNU awk also has a debugger, but I never used it; usually a few smartly placed
`printf "...",... >"/dev/stderr" ` statements are sufficient to find the problem.
@nixCraft https://github.com/TheMozg/awk-raycaster Pseudo-3D shooter written completely in #gawk using raycasting technique #awk
Does someone want to check a little awk script?
Not deep into the language, the script already does what it's supposed to do (filter birdc show proto all output by DN42 BGP routes and outputs the number of routes).
But I'm not sure if next is intended to be used that way.
Before I started #adventofcode this year, I did a "day 0" with a trivial exercise and an excuse to get my test harness and makefiles in order. That was a good decision.
I also decided to do AOC23 in awk, and I think I have relearned enough awk to understand why its best use is the one-liner and where it's increasingly horrible as the programs get bigger and more complex.
So a decision and a poll.
Day 3 of #AdventofCode in the books.
One notable feature of gawk that's not in goawk is "arrays of arrays", so I have an extra credit task to convert my array handling to something more portable so that the job will build on goawk as well.
This was quite a bit harder than day 1 or day 2.
My solution pulled the whole data set into memory in one pass, then computed the answer in a second pass.. I think memory usage could have been smaller with a single pass.
Things to like about gawk for Advent of Code.
1. Hardly anyone else is doing it that language, so less chance of spoilers.
2. Parsing the input file is very easy because a lot of boilerplate work is done or easy to do (implicit split of input field).
3. Associative arrays (key-value arrays) as a language primitive. Wikipedia has a Rosetta Stone of sorts on equivalences in other languages where they are sometimes called maps, hashes, or dictionaries.
https://en.wikipedia.org/wiki/Comparison_of_programming_languages_(associative_array)