home.social

#awk — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #awk, aggregated by home.social.

fetched live
  1. @tubsta

    I'm confused…I use

    $ sudo freebsd-update fetch install

    occasionally to upgrade to the latest patch release, and every item in `beadm list` had RELEASE in it. So my #awk nuked all the 14.3 except the most recent 14.3(p16) just in case:

    14.3-RELEASE-p3_2025-10-09_101845
    14.3-RELEASE-p4_2025-11-23_220745
    14.3-RELEASE-p5_2025-12-17_103352
    14.3-RELEASE-p7_2026-02-17_161940
    14.3-RELEASE-p8_2026-02-25_182923
    14.3-RELEASE-p9_2026-04-21_152417
    14.3-RELEASE-p11_2026-04-29_145359
    14.3-RELEASE-p12_2026-05-04_071612
    14.3-RELEASE-p13_2026-05-21_064046
    14.3-RELEASE-p14_2026-06-09_213408
    14.3-RELEASE-p15_2026-06-30_153803

    Are you using freebsd-update in some different way that results in non-RELEASE boot environments/snapshots?

    @lattera

  2. @tubsta

    I'm confused…I use

    $ sudo freebsd-update fetch install

    occasionally to upgrade to the latest patch release, and every item in `beadm list` had RELEASE in it. So my #awk nuked all the 14.3 except the most recent 14.3(p16) just in case:

    14.3-RELEASE-p3_2025-10-09_101845
    14.3-RELEASE-p4_2025-11-23_220745
    14.3-RELEASE-p5_2025-12-17_103352
    14.3-RELEASE-p7_2026-02-17_161940
    14.3-RELEASE-p8_2026-02-25_182923
    14.3-RELEASE-p9_2026-04-21_152417
    14.3-RELEASE-p11_2026-04-29_145359
    14.3-RELEASE-p12_2026-05-04_071612
    14.3-RELEASE-p13_2026-05-21_064046
    14.3-RELEASE-p14_2026-06-09_213408
    14.3-RELEASE-p15_2026-06-30_153803

    Are you using freebsd-update in some different way that results in non-RELEASE boot environments/snapshots?

    @lattera

  3. @lattera

    Nothing like a little

    $ beadm list | awk '/^14.3/ && !/14.3.*p16/{print $1}' | while read ds ; do echo $ds; yes | echo sudo beadm delete $ds ; done

    to let #awk choose the relevant unused boot-environments and nuke them (and their associated datasets). Removed the "echo" once it looked good, and ran for real, freeing ~15GB here. 👍

  4. @lattera

    Nothing like a little

    $ beadm list | awk '/^14.3/ && !/14.3.*p16/{print $1}' | while read ds ; do echo $ds; yes | echo sudo beadm delete $ds ; done

    to let #awk choose the relevant unused boot-environments and nuke them (and their associated datasets). Removed the "echo" once it looked good, and ran for real, freeing ~15GB here. 👍

  5. Stars and Cartesian coordinates printed in nice columns with #awk

    awk -F, '{printf "%-25s %8.3f %8.3f %8.3f\n", $1, $2, $3, $4}' hipparcos.csv

  6. Stars and Cartesian coordinates printed in nice columns with

    awk -F, '{printf "%-25s %8.3f %8.3f %8.3f\n", $1, $2, $3, $4}' hipparcos.csv

  7. Combinations of r elements chosen from a pool of n elements with #awk

    BEGIN {
    for (i=1; i <= r; i++) {
    A[i] = i
    if (i < r ) printf i OFS
    else print i}
    while (A[1] < n - r + 1) {
    for (i = r; i >= 1; i--) {
    if (A[i] < n - r + i) {
    A[i]++
    p = i
    break}}
    for (i = p + 1; i <= r; i++) A[i] = A[i - 1] + 1
    for (i=1; i <= r; i++) {
    if (i < r) printf A[i] OFS
    else print A[i]}}
    exit}

  8. Combinations of r elements chosen from a pool of n elements with

    BEGIN {
    for (i=1; i <= r; i++) {
    A[i] = i
    if (i < r ) printf i OFS
    else print i}
    while (A[1] < n - r + 1) {
    for (i = r; i >= 1; i--) {
    if (A[i] < n - r + i) {
    A[i]++
    p = i
    break}}
    for (i = p + 1; i <= r; i++) A[i] = A[i - 1] + 1
    for (i=1; i <= r; i++) {
    if (i < r) printf A[i] OFS
    else print A[i]}}
    exit}

  9. somebody please help stop me.

    I have two toy-project ideas.

    They require using JavaScript. One might even involve PHP (though I might be able to do it as a cgi-bin in #awk instead)

    Send help. 😖

  10. somebody please help stop me.

    I have two toy-project ideas.

    They require using JavaScript. One might even involve PHP (though I might be able to do it as a cgi-bin in #awk instead)

    Send help. 😖

  11. @rqm

    It may depend on your personal preferences, but the base system already gives you enough to do Unix-as-IDE¹

    • tmux
    • vi/ed/mg to edit
    • clang to compile
    • make(1) for building/dependencies
    • rcs/cvs for version-control
    • a shell (whether you prefer sh/ksh/csh) with standard file-management commands (mv/cp/rm/cd/ls/cat/less/…)
    • standard POSIX tools (sed/awk/grep/…)
    • man-pages

    You can easily swap out any of those components you don't like. Prefer editing with Vim/Neovim or Emacs? Go for it. Prefer GCC or tcc to compile your C? Just a pkg_add away. Want git, got, subversion, fossil, or jujutsu? Same deal. More of a zsh/fish/bash sort of person or prefer ripgrep or Silver Searcher, or GNU #awk or mawk? Again, swap in what you prefer.

    For my own C development, I use vi/vim/ed for editing, and git for version-control, but generally stick with the other base-system options.


    ¹ blog.sanctum.geek.nz/series/un

  12. @rqm

    It may depend on your personal preferences, but the base system already gives you enough to do Unix-as-IDE¹

    • tmux
    • vi/ed/mg to edit
    • clang to compile
    • make(1) for building/dependencies
    • rcs/cvs for version-control
    • a shell (whether you prefer sh/ksh/csh) with standard file-management commands (mv/cp/rm/cd/ls/cat/less/…)
    • standard POSIX tools (sed/awk/grep/…)
    • man-pages

    You can easily swap out any of those components you don't like. Prefer editing with Vim/Neovim or Emacs? Go for it. Prefer GCC or tcc to compile your C? Just a pkg_add away. Want git, got, subversion, fossil, or jujutsu? Same deal. More of a zsh/fish/bash sort of person or prefer ripgrep or Silver Searcher, or GNU #awk or mawk? Again, swap in what you prefer.

    For my own C development, I use vi/vim/ed for editing, and git for version-control, but generally stick with the other base-system options.


    ¹ blog.sanctum.geek.nz/series/un

  13. Allocating hostel beds is like choosing seats at the tables at our wedding all over again, every single year...

    Has anyone written a constraint solver for this in #awk I could use??

  14. Allocating hostel beds is like choosing seats at the tables at our wedding all over again, every single year...

    Has anyone written a constraint solver for this in #awk I could use??

  15. Основатель движения мейкеров Дейл Догерти расспросил Майю и Свету об их проектах на нашем кружке электроники

    Я писал в предыдущих постах, что наш митап по верилогу пригласили на мероприятие торговой палаты города Маунтин-Вью, Калифорния. И вот мероприятие состоялось. Ну, как я уже написал в заголовке, на наш стенд зашел Дейл Догерти, основатель журнала самоделкиных Make Magazine и выставок Maker Faire. Дейл расспросил Майю и Свету почему у них возник интерес к проектам с микросхемами малой степени интеграции.

    habr.com/ru/articles/1065220/

    #cmos_4000 #maker_faire #make_magazine #awk #sed #oreilly #SystemVerilog #verilog_meetup #hacker_dojo #mountain_view

  16. A Mercator map claimed to divide humanity into two equal geographic groups. My wife asked what it would look like using the Equal Earth projection--so I rebuilt it from an SVG, GeoNames population data, awk, a spreadsheet, and a little CSS. The highlighted countries contain 49.65% of the listed world population.

    salemdata.net/johnpress/?p=1113

    #Cartography #EqualEarth #Mercator #DataVisualization #SVG #OpenData #Linux #awk

  17. A Mercator map claimed to divide humanity into two equal geographic groups. My wife asked what it would look like using the Equal Earth projection--so I rebuilt it from an SVG, GeoNames population data, awk, a spreadsheet, and a little CSS. The highlighted countries contain 49.65% of the listed world population.

    salemdata.net/johnpress/?p=1113

    #Cartography #EqualEarth #Mercator #DataVisualization #SVG #OpenData #Linux #awk

  18. Funny, when I process a bunch of CSV files with #awk, it never asks me to rate it in an app store, let alone proceed to complain that I can't write a review. 😉

    social.chinwag.org/@mike/11694

  19. Funny, when I process a bunch of CSV files with #awk, it never asks me to rate it in an app store, let alone proceed to complain that I can't write a review. 😉

    social.chinwag.org/@mike/11694

  20. Does anybody else here use Wordle to keep their `awk` skills fresh?

    #dailygames #wordle #awk #regex

  21. Does anybody else here use Wordle to keep their `awk` skills fresh?

    #dailygames #wordle #awk #regex

  22. I've been riding a #nerd #high since late June and here is one of the results.

    codeberg.org/tnalpgge/cabrillo

    While it is not directly responsible for helping me #slice and #dice our #hamradio contact logs from this past #FieldDay, it did eliminate the need for a bunch of #shell and #awk that I was using previously. Of course, by replacing some compact, proven scripts by a larger library of #Emacs #Lisp is more of an exercise in #purity than #practicality. Still, playing with #peg and formal-ish grammars was an interesting alternative to my traditional #regex approach to text processing.

    It's not a thorough test suite, but it did help me catch two bugs this evening!

  23. I've been riding a #nerd #high since late June and here is one of the results.

    codeberg.org/tnalpgge/cabrillo

    While it is not directly responsible for helping me #slice and #dice our #hamradio contact logs from this past #FieldDay, it did eliminate the need for a bunch of #shell and #awk that I was using previously. Of course, by replacing some compact, proven scripts by a larger library of #Emacs #Lisp is more of an exercise in #purity than #practicality. Still, playing with #peg and formal-ish grammars was an interesting alternative to my traditional #regex approach to text processing.

    It's not a thorough test suite, but it did help me catch two bugs this evening!

  24. @philip

    FWIW, #awk should print from each <h4> to the first-subsequent </p> that follows the <h4>

    To demonstrate, try this input

    <h4> first
    print this
    </p> first close-p
    </p> second close-p won't print
    more unprinted stuff
    <h4>another h4
    more printed
    </p> a first-subsequent close-p will print
    </p> another subsequent close-p shouldn't print
    more stuff not to print

  25. @philip

    FWIW, #awk should print from each <h4> to the first-subsequent </p> that follows the <h4>

    To demonstrate, try this input

    <h4> first
    print this
    </p> first close-p
    </p> second close-p won't print
    more unprinted stuff
    <h4>another h4
    more printed
    </p> a first-subsequent close-p will print
    </p> another subsequent close-p shouldn't print
    more stuff not to print

  26. #Unix / #sed / #awk / #shell ninjas,

    What's the easiest way to suppress anything more than 2-3 blank lines at a time? I don't want to remove all blank lines, just excessive blank lines.

    I'm coming up with a simple shell function to strip html tags, because I don't like the way terminal browsers re-flow/wrap the text when you use the -dump|--dump option.

    The way I'd normally do it is something like:

    sed 's/$/{lineend}/' |tr -d '\n' |sed -E 's/(\{lineend\}){3,}/\1\1\1/g; s/\{lineend\}/\n/g'
    

    …but I figure there's probably a more elegant way?

  27. #Unix / #sed / #awk / #shell ninjas,

    What's the easiest way to suppress anything more than 2-3 blank lines at a time? I don't want to remove all blank lines, just excessive blank lines.

    I'm coming up with a simple shell function to strip html tags, because I don't like the way terminal browsers re-flow/wrap the text when you use the -dump|--dump option.

    The way I'd normally do it is something like:

    sed 's/$/{lineend}/' |tr -d '\n' |sed -E 's/(\{lineend\}){3,}/\1\1\1/g; s/\{lineend\}/\n/g'
    

    …but I figure there's probably a more elegant way?

  28. @rl_dane

    Fortunately, OpenBSD also makes it fairly easy to drop a ktrace(1) on a command and then dump what it's doing:

    $ ktrace -f pkg_info.ktrace -d pkg_info -Q remind

    $ kdump -R -f pkg_info.ktrace | less

    A little #awk on that might highlight expensive steps

    $ kdump -R -f pkg_info.ktrace | awk '$1+0 > 0 && $4 == toupper($4) && $3 > 0.05 && NR>1'

    (adjust the "0.05" until the result-count returns interesting-but-not-too-much data)

  29. @rl_dane

    Fortunately, OpenBSD also makes it fairly easy to drop a ktrace(1) on a command and then dump what it's doing:

    $ ktrace -f pkg_info.ktrace -d pkg_info -Q remind

    $ kdump -R -f pkg_info.ktrace | less

    A little #awk on that might highlight expensive steps

    $ kdump -R -f pkg_info.ktrace | awk '$1+0 > 0 && $4 == toupper($4) && $3 > 0.05 && NR>1'

    (adjust the "0.05" until the result-count returns interesting-but-not-too-much data)

  30. How does one go about proposing errata for RFCs? While dumb, RFC1436¹ under "Full-Text Search Transaction" is missing "S: Accepts connection" which the other sample transactions have.

    (I'm also not sure why the case differs, where tha client will "Open Connection" (uppercase C) but the server will "Accept [Cc]onnection" (case varies in RFC) which seems like a minor inconsistency)

    And no, I am totally not playing with writing my gopherspace game server in #awk. Really. Okay, maybe exploring the idea just a bit…


    ¹ datatracker.ietf.org/doc/html/

  31. @gumnos

    Whoa, that's some #awk alphabet soup.

    I'm gonna need to learn awk next, ain't I? XD

    I actually started out doing it all in grep (pipe the words in the file to grep -vixfF /usr/share/dict/words, but it was actually twice as fast to do a positive grep per input word than one big negative grep.

    I'm actually already removing duplicates via an awk command that I copypastad from the internet, but I'll play with your example, thanks! :D