you are viewing a single comment's thread
view the rest of the comments
[–] 66 points 1 year ago (9 children)

Why spend 30 seconds manually editing some text when you can spend 30 minutes clobbering together a pipeline involving awk, sed and jq

  • source
  • hideshow 9 child comments
  • [–] 21 points 1 year ago (5 children)

    to be fair, out of those three, jq invokes the least existential dread in me

  • source
  • parent
  • hideshow 5 child comments
  • [–] 4 points 1 year ago (4 children)

    The important part is to learn the limits of any tool. Nowadays I no longer use jq for any long or complicated tasking. Filter and view data? jq is fine. Anything more and I just cook up a python script.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 5 points 1 year ago (3 children)

    i'm more of a bash fan tbh. Ever since i started using linux, python started to irritate me

  • source
  • parent
  • hideshow 3 child comments
  • [–] 4 points 1 year ago (2 children)

    How do you get complex data structures to work? I was alienated from scripting on zsh because I wanted something like a dict and realised I would have to write my own implementation. Is there a work around for that?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 6 points 1 year ago* (1 child)

    I mean, there's a point in data structure complexity where it's useful to use Python.

    But as to dicts, sure. You're looking for zsh's "associative array". Bash has it too.

    zsh

    $ typeset -A mydict
    $ mydict[foo]=bar 
    $ echo $mydict[foo]
    bar
    $
    

    bash

    $ typeset -A mydict
    $ mydict[foo]=bar
    $ echo ${mydict[foo]}
    bar
    $
    
  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 1 year ago

    This will do nicely - I had several workflows where I'd hit an API and get a massive super nested JSON as output; I'd use jq to get the specific data from the whole thing and do a bunch of stuff on this filtered data. I pretty much resigned to using python because I'd have successively complicated requirements and looking up how to do each new thing was slowing me down massively.

  • source
  • parent