« first day (4072 days earlier)      last day (1106 days later) » 

13:24
Sorry, @ilkkachu, brain fart.
 
9 hours later…
21:58
Anyone know how I could variably pad text with printf?
say I had a variable length string but wanted the output to always be padded 80 columns, I could do like pad=$((80-${#string})) but then how do I use $pad?
printf has that capability built in, just set 80 as the field width
printf "%80s" "$string"
22:26
Yes but if I want printf '%s %80s' "$variable_length_string" "$string2"
I want string2 to be padded 80 columns regardless of the length of the first string
22:41
@jesse_b Pad $variable_length_string to the right?
printf "%-80s %s\n" "$variable_length_string" "$string2"
(Not sure I'm understanding what result you are expecting, sorry)
I have sort of a janky solution
string1=foo
padsize=$((80-${#string1}))
printf '%s' "$string1"
printf '%*s' "$padsize"
printf '%s\n' pass
oh actually yes hah
Ah, good.
thank you
I guess I actually wanted right padding
22:49
You're welcome!

« first day (4072 days earlier)      last day (1106 days later) »