home.social

#awk — Public Fediverse posts

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

  1. Coming to learn better the differences between #grep #awk and #sed.

    Learning that my frustration with grep is that I misunderstood what its (at least base and intended) function is, and I've been trying to make it do things that are much more suited to things like sed and awk.

    Time to learn some awk.

  2. Coming to learn better the differences between #grep #awk and #sed.

    Learning that my frustration with grep is that I misunderstood what its (at least base and intended) function is, and I've been trying to make it do things that are much more suited to things like sed and awk.

    Time to learn some awk.

  3. Coming to learn better the differences between #grep #awk and #sed.

    Learning that my frustration with grep is that I misunderstood what its (at least base and intended) function is, and I've been trying to make it do things that are much more suited to things like sed and awk.

    Time to learn some awk.

  4. Coming to learn better the differences between #grep #awk and #sed.

    Learning that my frustration with grep is that I misunderstood what its (at least base and intended) function is, and I've been trying to make it do things that are much more suited to things like sed and awk.

    Time to learn some awk.

  5. Coming to learn better the differences between #grep #awk and #sed.

    Learning that my frustration with grep is that I misunderstood what its (at least base and intended) function is, and I've been trying to make it do things that are much more suited to things like sed and awk.

    Time to learn some awk.

  6. @finner Here's a solution using perl instead:

    perl -wlne 'if (m{/wifi} ... m{^/}) { print $1 if /\bPowered = (\S+)/ }'

    (Translation to awk is left as an exercise for the reader.)

    #perl #awk

  7. While I guessed it was the case, #TIL (or today I *confirmed*) that #awk doesn't support first-class functions, meaning you can't do

    function x(s) { print "X:", s }
    function y(s) { print "Y:", s }
    BEGIN {
    # can't assign a function to a variable
    a[0] = x
    a[1] = y

    # which would allow me to randomly choose a function:
    srand()
    zero_or_one = int(rand()*2)
    a[zero_or_one]("hello")
    }

  8. While I guessed it was the case, #TIL (or today I *confirmed*) that #awk doesn't support first-class functions, meaning you can't do

    function x(s) { print "X:", s }
    function y(s) { print "Y:", s }
    BEGIN {
    # can't assign a function to a variable
    a[0] = x
    a[1] = y

    # which would allow me to randomly choose a function:
    srand()
    zero_or_one = int(rand()*2)
    a[zero_or_one]("hello")
    }

  9. While I guessed it was the case, #TIL (or today I *confirmed*) that #awk doesn't support first-class functions, meaning you can't do

    function x(s) { print "X:", s }
    function y(s) { print "Y:", s }
    BEGIN {
    # can't assign a function to a variable
    a[0] = x
    a[1] = y

    # which would allow me to randomly choose a function:
    srand()
    zero_or_one = int(rand()*2)
    a[zero_or_one]("hello")
    }

  10. While I guessed it was the case, #TIL (or today I *confirmed*) that #awk doesn't support first-class functions, meaning you can't do

    function x(s) { print "X:", s }
    function y(s) { print "Y:", s }
    BEGIN {
    # can't assign a function to a variable
    a[0] = x
    a[1] = y

    # which would allow me to randomly choose a function:
    srand()
    zero_or_one = int(rand()*2)
    a[zero_or_one]("hello")
    }

  11. While I guessed it was the case, #TIL (or today I *confirmed*) that #awk doesn't support first-class functions, meaning you can't do

    function x(s) { print "X:", s }
    function y(s) { print "Y:", s }
    BEGIN {
    # can't assign a function to a variable
    a[0] = x
    a[1] = y

    # which would allow me to randomly choose a function:
    srand()
    zero_or_one = int(rand()*2)
    a[zero_or_one]("hello")
    }

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

    #awk #gnu

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

    #awk #gnu

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

    #awk #gnu

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

    #awk #gnu

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

    #awk #gnu

  17. @ctatwork not fun but I guess a huge part of this is scriptable. I just need to get back to #awk or #sed I guess to get things to go smoother...

    But I’ll only do that for the stable version of OmegaT.

    I need to create a "Warning" file to distribute with OmegaT.app though, since the internals of the package can’t be modified anymore, and this all the facilities we have (adding plugins inside the package etc.) are not available anymore...

  18. @ctatwork not fun but I guess a huge part of this is scriptable. I just need to get back to #awk or #sed I guess to get things to go smoother...

    But I’ll only do that for the stable version of OmegaT.

    I need to create a "Warning" file to distribute with OmegaT.app though, since the internals of the package can’t be modified anymore, and this all the facilities we have (adding plugins inside the package etc.) are not available anymore...

  19. @ctatwork not fun but I guess a huge part of this is scriptable. I just need to get back to #awk or #sed I guess to get things to go smoother...

    But I’ll only do that for the stable version of OmegaT.

    I need to create a "Warning" file to distribute with OmegaT.app though, since the internals of the package can’t be modified anymore, and this all the facilities we have (adding plugins inside the package etc.) are not available anymore...

  20. @ctatwork not fun but I guess a huge part of this is scriptable. I just need to get back to #awk or #sed I guess to get things to go smoother...

    But I’ll only do that for the stable version of OmegaT.

    I need to create a "Warning" file to distribute with OmegaT.app though, since the internals of the package can’t be modified anymore, and this all the facilities we have (adding plugins inside the package etc.) are not available anymore...

  21. @rl_dane

    Unless the "meme language" is #awk or Forth, in which case I might consider it 😆

  22. @rl_dane

    Unless the "meme language" is #awk or Forth, in which case I might consider it 😆

  23. @rl_dane

    Unless the "meme language" is #awk or Forth, in which case I might consider it 😆

  24. @rl_dane

    Unless the "meme language" is #awk or Forth, in which case I might consider it 😆

  25. @rl_dane

    Unless the "meme language" is #awk or Forth, in which case I might consider it 😆

  26. Most #awk users know that a pattern without an explicit action defaults to a print action, and an action without a pattern matches every input line.

    But BEGIN/END don't seem to be treated as patterns, so

    $ … | awk END

    bails out rather than behaving like `… | tail -1`, complaining that END *requires* an action block, rather than defaulting to the print action.

    #TIL

  27. Most #awk users know that a pattern without an explicit action defaults to a print action, and an action without a pattern matches every input line.

    But BEGIN/END don't seem to be treated as patterns, so

    $ … | awk END

    bails out rather than behaving like `… | tail -1`, complaining that END *requires* an action block, rather than defaulting to the print action.

    #TIL

  28. Most #awk users know that a pattern without an explicit action defaults to a print action, and an action without a pattern matches every input line.

    But BEGIN/END don't seem to be treated as patterns, so

    $ … | awk END

    bails out rather than behaving like `… | tail -1`, complaining that END *requires* an action block, rather than defaulting to the print action.

    #TIL

  29. Most #awk users know that a pattern without an explicit action defaults to a print action, and an action without a pattern matches every input line.

    But BEGIN/END don't seem to be treated as patterns, so

    $ … | awk END

    bails out rather than behaving like `… | tail -1`, complaining that END *requires* an action block, rather than defaulting to the print action.

    #TIL

  30. Most #awk users know that a pattern without an explicit action defaults to a print action, and an action without a pattern matches every input line.

    But BEGIN/END don't seem to be treated as patterns, so

    $ … | awk END

    bails out rather than behaving like `… | tail -1`, complaining that END *requires* an action block, rather than defaulting to the print action.

    #TIL

  31. 🎉 Behold the marvel: "Pu.sh" - a #tiny disaster-in-a-pocket, crammed into a mere 400 lines of shell! 🔧🤡 Who needs modern tools like #npm or #Docker when you can just duct-tape it with #curl and awk? 🚀👀
    pu.dev/ #Pu.sh #disaster #shell #awk #HackerNews #ngated

  32. 🎉 Behold the marvel: "Pu.sh" - a #tiny disaster-in-a-pocket, crammed into a mere 400 lines of shell! 🔧🤡 Who needs modern tools like #npm or #Docker when you can just duct-tape it with #curl and awk? 🚀👀
    pu.dev/ #Pu.sh #disaster #shell #awk #HackerNews #ngated

  33. 🎉 Behold the marvel: "Pu.sh" - a #tiny disaster-in-a-pocket, crammed into a mere 400 lines of shell! 🔧🤡 Who needs modern tools like #npm or #Docker when you can just duct-tape it with #curl and awk? 🚀👀
    pu.dev/ #Pu.sh #disaster #shell #awk #HackerNews #ngated

  34. 🎉 Behold the marvel: "Pu.sh" - a #tiny disaster-in-a-pocket, crammed into a mere 400 lines of shell! 🔧🤡 Who needs modern tools like #npm or #Docker when you can just duct-tape it with #curl and awk? 🚀👀
    pu.dev/ #Pu.sh #disaster #shell #awk #HackerNews #ngated

  35. 🎉 Behold the marvel: "Pu.sh" - a #tiny disaster-in-a-pocket, crammed into a mere 400 lines of shell! 🔧🤡 Who needs modern tools like #npm or #Docker when you can just duct-tape it with #curl and awk? 🚀👀
    pu.dev/ #Pu.sh #disaster #shell #awk #HackerNews #ngated

  36. Lua has many dialects, and I love them all ❤️
    But how to write one lua-file and target them all?
    Answer: metaprogramming

    Here's a small ~700 bytes gpp-ish metaprogramming awk script 🎉

    #lua #teal #nelua #redbean #esp32 #wasm #love2D #awk

    ps. its not limited to lua :coolcat:

    codeberg.org/coderofsalvation/

  37. Lua has many dialects, and I love them all ❤️
    But how to write one lua-file and target them all?
    Answer: metaprogramming

    Here's a small ~700 bytes gpp-ish metaprogramming awk script 🎉

    #lua #teal #nelua #redbean #esp32 #wasm #love2D #awk

    ps. its not limited to lua :coolcat:

    codeberg.org/coderofsalvation/

  38. Lua has many dialects, and I love them all ❤️
    But how to write one lua-file and target them all?
    Answer: metaprogramming

    Here's a small ~700 bytes gpp-ish metaprogramming awk script 🎉

    #lua #teal #nelua #redbean #esp32 #wasm #love2D #awk

    ps. its not limited to lua :coolcat:

    codeberg.org/coderofsalvation/

  39. Lua has many dialects, and I love them all ❤️
    But how to write one lua-file and target them all?
    Answer: metaprogramming

    Here's a small ~700 bytes gpp-ish metaprogramming awk script 🎉

    #lua #teal #nelua #redbean #esp32 #wasm #love2D #awk

    ps. its not limited to lua :coolcat:

    codeberg.org/coderofsalvation/

  40. Lua has many dialects, and I love them all ❤️
    But how to write one lua-file and target them all?
    Answer: metaprogramming

    Here's a small ~700 bytes gpp-ish metaprogramming awk script 🎉

    #lua #teal #nelua #redbean #esp32 #wasm #love2D #awk

    ps. its not limited to lua :coolcat:

    codeberg.org/coderofsalvation/

  41. Friendship ended with #awk
    Now #tcl is my best friend

    I like its way of doing control flow by passing quoted commands rather than a block of actual commands itself. Looks like a poor man's metaprogramming (or something i'd implement in a Lisp with no distinction between macros and procedures or with a call-by-name/on-demand evaluation of procedures).
    Am gonna use it for large scripts and prototyping.

  42. Friendship ended with #awk
    Now #tcl is my best friend

    I like its way of doing control flow by passing quoted commands rather than a block of actual commands itself. Looks like a poor man's metaprogramming (or something i'd implement in a Lisp with no distinction between macros and procedures or with a call-by-name/on-demand evaluation of procedures).
    Am gonna use it for large scripts and prototyping.

  43. Friendship ended with #awk
    Now #tcl is my best friend

    I like its way of doing control flow by passing quoted commands rather than a block of actual commands itself. Looks like a poor man's metaprogramming (or something i'd implement in a Lisp with no distinction between macros and procedures or with a call-by-name/on-demand evaluation of procedures).
    Am gonna use it for large scripts and prototyping.

  44. Friendship ended with #awk
    Now #tcl is my best friend

    I like its way of doing control flow by passing quoted commands rather than a block of actual commands itself. Looks like a poor man's metaprogramming (or something i'd implement in a Lisp with no distinction between macros and procedures or with a call-by-name/on-demand evaluation of procedures).
    Am gonna use it for large scripts and prototyping.

  45. Friendship ended with #awk
    Now #tcl is my best friend

    I like its way of doing control flow by passing quoted commands rather than a block of actual commands itself. Looks like a poor man's metaprogramming (or something i'd implement in a Lisp with no distinction between macros and procedures or with a call-by-name/on-demand evaluation of procedures).
    Am gonna use it for large scripts and prototyping.