I would like to format data returned from my command line tools using tabs. I am not sure whether the solution is specific to Ruby or MacOS, could you provide an example of how to do this? (Maybe a simple Ruby puts statement with tabbed values) All of my research returned items dealing with having multiple shell sessions in the same window. Thanks
I would like to format data returned from my command line tools using tabs.
Share
A tab character is represented by a
"\t"in strings.You may still need to do some string size checks for when a string overflows a field. Plus tab sizes are device-/app-dependent, so things will not necessarily align the same way across all viewing mechanisms (editors, terminals, pagers, etc.) if it’s just being imported into, say, a spreadsheet, that doesn’t matter.
IIRC there are some gems/libraries for doing various text alignment tasks, no references at the moment.