cut command in Mac terminal lacks complement option cut command in Mac terminal lacks complement option unix unix

cut command in Mac terminal lacks complement option


The correct way to solve this for generic use-cases with --complement, would be:

brew install coreutils

as gnu-cut is part of the pkg.


If you really just want all but the first argument, use shift.

#!/bin/shfirst_arg=$1shiftprintf '%s\n' "$@"  # Prints all but the first argument, one per line


You can install gcut, the GNU version of cut using homebrew.

brew install gcut

That one supports --complement.