News for hackers. Stuff that matters.
Re:The Hidden Gems of Moreutils by bloopernova on Saturday December 30, 2023 @10:21AM (#38815892)
In case anyone was wondering, the moreutils tools:

  chronic: runs a command quietly unless it fails
  combine: combine the lines in two files using boolean operations
  errno: look up errno names and descriptions
  ifdata: get network interface info without parsing ifconfig output
  ifne: run a program if the standard input is not empty
  isutf8: check if a file or standard input is utf-8
  lckdo: execute a program with a lock held
  mispipe: pipe two commands, returning the exit status of the first
  parallel: run multiple jobs at once
  pee: tee standard input to pipes
  sponge: soak up standard input and write to a file
  ts: timestamp standard input
  vidir: edit a directory in your text editor
  vipe: insert a text editor into a pipe
  zrun: automatically uncompress arguments to command
from https://rentes.github.io/unix/utilities/2015/07/27/moreutils...

Similarly, there's some lesser-known useful stuff in GNU Coreutils:

https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_com...

  paste: Merges lines of files
  expand: Converts tabs to spaces
  seq: prints a sequence of numbers
  shuf: shuffles its input
Re:The Hidden Gems of Moreutils by jeffbee on Saturday December 30, 2023 @12:07PM (#38816753)
Confusingly, moreutils parallel is not "GNU parallel". Moreutils parallel is very simple, while the other parallel is very featureful. Linux distributions can deal with the conflict, but bad package managers like homebrew cannot.
Re:The Hidden Gems of Moreutils by mlk on Saturday December 30, 2023 @01:15PM (#38817334)
"rename" shares the same fate, there are several implantations, completely different from each other
Re:The Hidden Gems of Moreutils by koolba on Saturday December 30, 2023 @10:38AM (#38816035)
seq is “less known”? I’d assume anyone familiar with shell scripting would know about it.

It’s a great starting point for entertaining children on a terminal:

    seq 99 -1 0 | xargs printf ‘%s bottles of beer on the wall…\n’
Re:The Hidden Gems of Moreutils by foobarian on Saturday December 30, 2023 @10:49AM (#38816121)
Bash kinda broke seq for me since you can just write {99..0}
Re:The Hidden Gems of Moreutils by o11c on Saturday December 30, 2023 @11:48AM (#38816613)
Or if you need dynamic arguments, you probably want:

    N=9; for ((i=0; i<=N; ++i)); do echo "$i"; done
Re:The Hidden Gems of Moreutils by andrewshadura on Saturday December 30, 2023 @01:44PM (#38817658)
Why use this form of for when you can just use seq and it works in any shell including fish?
Re:The Hidden Gems of Moreutils by o11c on Saturday December 30, 2023 @04:24PM (#38819316)
Because capturing the output of `seq` requires spawning a whole separate process (significant for small sequences) and shoving all the data into a single buffer (significant for large sequences) rather than working incrementally.
Re:The Hidden Gems of Moreutils by bloopernova on Saturday December 30, 2023 @10:53AM (#38816146)
Less known maybe for most people who read HN, but you're right that a lot of shell scripting folks would know about it.
Re:The Hidden Gems of Moreutils by agumonkey on Saturday December 30, 2023 @11:44AM (#38816569)
thanks for the tl;dr

moreutils and similar pops up every year but it's still easy to forget.. they should be part of core distributions nowadays..