Artificial intelligent assistant

How to get just the number from units? The default output of `units` seems to be a bit verbose: $ units "2 fortnight" seconds * 2419200 / 4.1335979e-07 Suppose I just want the number only, so that I can do things like `sleep $(units "2 fortnight" seconds)`. Is there a formatting argument for `units` that I'm missing? Or is there some simple way to pipe it into something and get just the number? I can see that `$ units "2 fortnight" seconds | head -n 1` would at least get rid of the factor, but I still have the extra whitespace and `*`.

With `GNU Units version 2.19`:


$ units --one-line --compact '2 fortnight' seconds
2419200


BSD implementation of `units` doesn't have `--one-line --compact` but you can use awk:


$ units '2 fortnight' seconds | awk 'NR == 1 {print $2}'
2419200

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e97f498d4fcd71fcb354f3ad11d4c9f2