Intelligent automatic text file formatting