I have an awk script that I'm using to print out the columns of a file and I have the column width set to 60 for each:
printf ("%-60s %-60s\n", value1, value2)
That works fine, but in this case, I want the fields to be tabbed, but obviously with a longer line X number of tabs will not keep them aligned.
Ex. ThisIsAReallyLongString
ButThisIsNot
If I append 2 tabs, "ButThisIsNot" won't align with "ThisIsAReallyLongString".
How can I determine the correct number of tabs so the columns align? i.e. it would need to add 3 tabs in some cases, 2 tabs in others, etc.
Any help would be greatly appreciated.
Thanks,
John
printf ("%-60s %-60s\n", value1, value2)
That works fine, but in this case, I want the fields to be tabbed, but obviously with a longer line X number of tabs will not keep them aligned.
Ex. ThisIsAReallyLongString
ButThisIsNot
If I append 2 tabs, "ButThisIsNot" won't align with "ThisIsAReallyLongString".
How can I determine the correct number of tabs so the columns align? i.e. it would need to add 3 tabs in some cases, 2 tabs in others, etc.
Any help would be greatly appreciated.
Thanks,
John