I am trying to figure out how to accurately line up some data in two separate columns in an output file that is basically a rewritten version of an input file. I know I could separate all non-whitespace-characters in one column from all non-whitespace-characters in another column (in theory), and then just separate the separate strings in the output with a specific constant number of spaces, but since I've already written code that attempts to use a different approach (i.e. basically reformat a line read from the input file to have the correct number of spaces between the two columns in the output file), I would like to get it working using my current approach, if possible.
Basically, the problem I'm experiencing is that the input file that I'm attempting to rewrite a different way doesn't just have space characters separating the two columns in the lines of the file. Instead, it also has tab characters. I know the '\t' character is an unspecified number of spaces, and different applications use a different length, so basically, what I need to do is figure out how many spaces it SHOULD represent (in the editor that I'm viewing the file in, gedit), and then simply count the number of tabs found in each line between the two columns, and then replace the tabs with the correct number of spaces, so that all data lines up.