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

1:24 PM
Sorry, @ilkkachu, brain fart.
 
9 hours later…
9:58 PM
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"
10:26 PM
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
10:41 PM
@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
10:49 PM
You're welcome!

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