How to fix the positions of output string in shell using printf
?
For example ,if I want to print text TEXT-A
at position starting from third position from left and one more text TEXT-B
at eleventh position from left,as shown below.
printf ' %-8s%s\n' TEXT-A TEXT-B
And if you want to truncate the first text if it too long to fit:
printf ' %-8.8s%s\n' TEXT-A TEXT-B