Question

Can anyone please inform me, how to save output of a C program to a text file without distorting the indentations? I have tried using ">" and using the "logsave" command but in both case the indentations of output changes. I have tried manipulating the output by using tabspaces and whitespaces but still the problem remains. Is there a way that the output is saved correctly? Output:

            +   ------  -------     +   ------  -------     +
Cache       |      L1D              |      L1D              |
Size        |      32K              |      32K              |
OScpu#      |        0        1     |        2        3     |
            +   ------  -------     +   ------  -------     +

Cache       |      L1I              |      L1I              |
Size        |      32K              |      32K              |
            +   ------  -------     +   ------  -------     +

Cache       |       L2              |       L2              |
Size        |     256K              |     256K              |
            +   ------  -------     +   ------  -------     +

Cache       |       L3                              |   
Size        |       3M                              |   
            +   ------  ------- ------- -------     +   

is the output coming on the terminal and when saved to the text file it changes to :

            +   ------  -------     +   ------  -------     +   
Cache       |      L1D              |      L1D              |   
Size        |   32K             |   32K             |   
OScpu#      |       0        1      |       2        3      |   
            +   ------  -------     +   ------  -------     +   

Cache       |      L1I          |      L1I          |   
Size        |   32K             |   32K             |   
            +   ------  -------     +   ------  -------     +   

Cache       |       L2              |       L2              |   
Size        |  256K             |  256K             |   
            +   ------  -------     +   ------  -------     +   

Cache       |       L3                              |   
Size        |    3M                             |
            +   ------  ------- ------- -------     +   

No correct solution

OTHER TIPS

You could convert all tabs in the output of your program to spaces.

Try this:

./prog | expand > log-file
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top