Sample Header Ad - 728x90

How to get just the number from units?

0 votes
2 answers
72 views
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 *.
Asked by Haterind (189 rep)
Aug 25, 2021, 06:40 PM
Last activity: Aug 25, 2021, 06:59 PM