home.social

#gawk — Public Fediverse posts

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

fetched live
  1. Factorial primes with #gawk

    #! /usr/bin/gawk -f
    function isprime(n, i) {
    if(n==2)return 1
    if(n<2||n%2==0)return 0
    for(i=3;i*i<=n;i+=2)
    if(n%i==0)return 0
    return 1
    }
    BEGIN {
    for(x=i=1;z<10;i++){
    x*=i
    if(isprime(x-1)){z++;print i"! - 1 = "x-1}
    if(isprime(x+1)){z++;print i"! + 1 = "x+1}
    }
    }

    The next output would be (if you had the patience to do it):

    27! + 1 = 10,888,869,450,418,352,160,768,000,001

  2. Factorial primes with

    #! /usr/bin/gawk -f
    function isprime(n, i) {
    if(n==2)return 1
    if(n<2||n%2==0)return 0
    for(i=3;i*i<=n;i+=2)
    if(n%i==0)return 0
    return 1
    }
    BEGIN {
    for(x=i=1;z<10;i++){
    x*=i
    if(isprime(x-1)){z++;print i"! - 1 = "x-1}
    if(isprime(x+1)){z++;print i"! + 1 = "x+1}
    }
    }

    The next output would be (if you had the patience to do it):

    27! + 1 = 10,888,869,450,418,352,160,768,000,001

  3. No sé por qué narices hay que indicar "BEGIN" a #gawk para que acepte el separador de campos desde el primer registro 😠

    #awk #gnu

  4. No sé por qué narices hay que indicar "BEGIN" a #gawk para que acepte el separador de campos desde el primer registro 😠

    #awk #gnu

  5. Found in awk-pta's README, this great interview with Prof. Alfred Aho about the origins of AWK: a-z.readthedocs.io/en/latest/a

    "it was born from the necessity to meet a need. As a researcher at Bell Labs in the early 1970s, I found myself keeping track of budgets..."

    "Some Wall Street financial houses used AWK when it first came out to balance their books because it was so easy to write data-processing programs in AWK..."

    Plot twist ! Is AWK the original tool ??

  6. Found in awk-pta's README, this great interview with Prof. Alfred Aho about the origins of AWK: a-z.readthedocs.io/en/latest/a

    "it was born from the necessity to meet a need. As a researcher at Bell Labs in the early 1970s, I found myself keeping track of budgets..."

    "Some Wall Street financial houses used AWK when it first came out to balance their books because it was so easy to write data-processing programs in AWK..."

    Plot twist ! Is AWK the original #plaintextaccounting tool ??

    #awk #gawk

  7. Gawk is such a wonderful program with such a wonderful and progressive type system. It doesn't assign types right at their birth, no, it let's them explore first and then choose their type themselves.

    #foss #awk #gawk #unix #posix #linux #gnu

  8. 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: u.fsf.org/463 #Emacs #gawk #CopyrightAssignments

  9. 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: u.fsf.org/463 #Emacs #gawk #CopyrightAssignments

  10. 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: u.fsf.org/463 #Emacs #gawk #CopyrightAssignments

  11. 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: u.fsf.org/463 #Emacs #gawk #CopyrightAssignments

  12. 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: u.fsf.org/463 #Emacs #gawk #CopyrightAssignments

  13. 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: u.fsf.org/463 #Emacs #gawk #CopyrightAssignments

  14. CW: Artificial text - On few occasion it's also funny. Meow

    🤯 Gawk at these harebrained schemes! I've got a real doozy for ya: "Flappy Paws" - a game where you play as a dog learning to fly with a pair of novelty inflatable wings. Just...gawp at the sheer lunacy of it all! #businessideas #gawk
    #BusinessIdea #Business #Ai #Llm #LlaMA2

  15. 把 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

    blog.gslin.org/archives/2024/1

    #Computer #Linux #Murmuring #OS #Programming #Software #apt #awk #deb822 #debian #format #gawk #legacy #linux #mawk #ubuntu

  16. 把 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

    blog.gslin.org/archives/2024/1

    #Computer #Linux #Murmuring #OS #Programming #Software #apt #awk #deb822 #debian #format #gawk #legacy #linux #mawk #ubuntu

  17. 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: grymoire.com/Unix/Awk.html

  18. 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: grymoire.com/Unix/Awk.html

  19. Стилистический Анализатор: Синхронизация порядка объявлений и определений функций

    У нас в организации есть обязательное правило оформления исходников, которое звучит так: Порядок объявления С-функций должен совпадать с порядком определения С-функций. В этом тексте представлен алгоритм работы консольной программы, которая автоматически выявляет нарушения этого странного правила.

    habr.com/ru/articles/844436/

    #ctags #awk #gawk #sed #cygwin #cmp #gcc #статический_анализ #стилистический_анализ #static_analysis

  20. @mos_8502 these concerns actually were core requirements when I was looking for a real language to rewrite to. + 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:

    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 + 9

  21. @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.

  22. #awk #gawk

    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.

    uvokchee.de/bird.txt

  23. @TicklishHoneyBee

    oh the last #bash #script I wrote I had #curl and #gawk in it to work, and it was a internet usage meter to work in #conky.

  24. @TicklishHoneyBee

    oh the last #bash #script I wrote I had #curl and #gawk in it to work, and it was a internet usage meter to work in #conky.

  25. OK, current stats are 63.5% of posts classified, with 29.8% of sites classified, a/k/a the old 65/30 rule. The mean posts per unclassified site is 1.765, so my returns for further classification will be ... small.

    Full breakdown:

       4 20
    14 19
    13 18
    23 17
    32 16
    37 15
    48 14
    55 13
    96 12
    120 11
    122 10
    168 9
    247 8
    315 7
    396 6
    622 5
    1052 4
    2016 3
    5103 2
    26494 1

    A ... large number of sites w/ <= 20 posts are actually classified, mostly by regexp rules & patterns. Oh, hey, I can dump that breakdown as well:

      35 20
    27 19
    47 18
    31 17
    33 16
    41 15
    51 14
    45 13
    42 12
    29 11
    46 10
    46 9
    47 8
    91 7
    138 6
    178 5
    269 4
    524 3
    1624 2
    11472 1

    I could pick just under 4% more posts by classifying another 564 sites but ... that sounds a bit too much like work at the moment. Compromises and trade-offs.

    Now to try to turn this into an analysis over time.

    I've been working with a summary of activity by site, so running analysis has been pretty quick (52k records and gawk running over that).

    To do full date analysis requires reading nearly 180k records, and ... hopefully not having to loop through 52k sites for each of those. Gawk's runtimes start to asplode when running tens of millions of loop iterations, especially if regexes are involved.

    #HackerNewsAnalytics #HackerNews #gawk #awk #DataAnalysis #MediaAnalysis

  26. OK, current stats are 63.5% of posts classified, with 29.8% of sites classified, a/k/a the old 65/30 rule. The mean posts per unclassified site is 1.765, so my returns for further classification will be ... small.

    Full breakdown:

       4 20
    14 19
    13 18
    23 17
    32 16
    37 15
    48 14
    55 13
    96 12
    120 11
    122 10
    168 9
    247 8
    315 7
    396 6
    622 5
    1052 4
    2016 3
    5103 2
    26494 1

    A ... large number of sites w/ <= 20 posts are actually classified, mostly by regexp rules & patterns. Oh, hey, I can dump that breakdown as well:

      35 20
    27 19
    47 18
    31 17
    33 16
    41 15
    51 14
    45 13
    42 12
    29 11
    46 10
    46 9
    47 8
    91 7
    138 6
    178 5
    269 4
    524 3
    1624 2
    11472 1

    I could pick just under 4% more posts by classifying another 564 sites but ... that sounds a bit too much like work at the moment. Compromises and trade-offs.

    Now to try to turn this into an analysis over time.

    I've been working with a summary of activity by site, so running analysis has been pretty quick (52k records and gawk running over that).

    To do full date analysis requires reading nearly 180k records, and ... hopefully not having to loop through 52k sites for each of those. Gawk's runtimes start to asplode when running tens of millions of loop iterations, especially if regexes are involved.

    #HackerNewsAnalytics #HackerNews #gawk #awk #DataAnalysis #MediaAnalysis

  27. How Much Colorado Love? Or a 16-year Hacker News Front Page analytics

    I've pulled 5,939 front pages from Hacker News, dating from 20 February 2007 to 25 May 2023, initially to answer the question "how often is Colorado mentioned on the front page?" (38 times, 5th most frequent US state). This also affords the opportunity to ask and answer other questions.

    Preliminary report: news.ycombinator.com/item?id=3

    #HackerNews #dataAnalysis #wget #awk #gawk #media #colorado

  28. How Much Colorado Love? Or a 16-year Hacker News Front Page analytics

    I've pulled 5,939 front pages from Hacker News, dating from 20 February 2007 to 25 May 2023, initially to answer the question "how often is Colorado mentioned on the front page?" (38 times, 5th most frequent US state). This also affords the opportunity to ask and answer other questions.

    Preliminary report: news.ycombinator.com/item?id=3

    #HackerNews #dataAnalysis #wget #awk #gawk #media #colorado

  29. #Introduction

    Hi, I’m Ken, I’ve been on the Fediverse for a couple of weeks now. It seemed silly to introduce myself to nobody when I first started this instance, although I did fill in my bio. I’m a #writer from England who joined the Fediverse to publicise my work and maybe try to #getfedihired. I’m still feeling my way around the social aspects of this though, I don’t just want to use this as an advertising platform.

    Looking back over my statuses for the first fortnight, so far I’ve mostly boosted things I found funny or beautiful. I replied to a few other posts including some responses to #SillyCuratorPrompts and #DesignChallenge – two drawings and a silly poem. And early on I posted another poem, largely to push past the anxiety I felt about the whole social media thing. The last thing I put up was some photos of spring flowers.

    I already have a blog at https://kenhutton.uk or https://kenhutton.uk/atom for your rss/atom reader. You can find more information about my book ‘Social card games’ there if you’re interested and I plan to post some stories and poems there soon, perhaps some essays too. No promises about when though, as I’m job hunting right now and not putting pressure on myself to do too much else.

    #writing #poems #poetry #bookdesign #typography #cardgames #ttrpg #wargame #crochet #knitting #tunisiancrochet #woodwork #dorset #walking #gawk #guix #TeX #publishing #design

  30. @cstross @thc It doesn’t get very far because multidimensional arrays (pretty important for this kind of thing) are a #gawk-ism:

    % a2p awkaster.awk
    syntax error in file awkaster.awk at line 23
    Translation aborted due to syntax errors.

    FYI a2p was removed along with find2perl and s2p from #Perl v5.22 onward in 2015: perldoc.perl.org/perl5220delta

    But you can get it from #CPAN: metacpan.org/dist/App-a2p

  31. November GNU Spotlight with Amin Bandali: Fifteen new #GNU releases in the last month, including #Bash, #Gawk, #Octave, #Nano, and #Taler (as of November 28, 2022): u.fsf.org/3vf Big thanks to @bandali0 @bandali, all the devs, and other contributors!