• palordrolap@fedia.io
    link
    fedilink
    arrow-up
    22
    ·
    1 day ago

    history | grep -E '(sed|grep|awk|perl)' | wc -l 107

    Dang. That’s out of 1000. I need to up my game. Also three of those seds are part of something with a -basedir and don’t count.

    So yeah, about 10% of my commands are iterating shell pipe things for poops and giggles, I guess.

    … and this got me going down the rabbit hole of writing a filter for my history to pull out the first command on the line. This is non-trivial because of potential preceding variable assignments. Most used commands are currently apt and man and ls. I think apt is a Spiders Georg situation because the system is fairly fresh and I keep finding things that I haven’t installed yet. Also I went through a patch of trying to parse its output.

    … oh, er… unga bunga.

    • flying_sheep@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      13 hours ago

      I just use nushell’s builtins instead of wrangling with IFS and bash idiosyncrasies. It’s been years since I’ve corrupted data by parsing text wrong.

      But even if someone doesn’t want that: apart from using it in legacy scripts, grep is just a strictly less useful ripgrep these days, no?