Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Shell Script Problems

Posted by: facetoe Aug 14 2011, 08:38 PM


I'm having trouble with formatting some text via the terminal. I can get it perfectly formatted, but when I try and copy paste the text from the output file it loses it's formatting. Very frustrating!

Basically I have 7 files (data data2 data3 data4 data5 data6 data7) containing a column of information each. I merge them all into one output file, with a separate column for each input file using:

paste data data2 data3 data4 data5 data6 data7 | awk '{printf "%-12s%-12s%-12s%-12s%-12s%-12s%-12s\n", $1, $2, $3, $4, $5, $6, $7}' > output

The result looks good in the output file and when the output is displayed in the Terminal, but when I copy paste from the output file into another file the columns become all jumbled.

I've also tried:
pr -m -t data data2 data3 data4 data5 data6 data7 >| expand > output

I have no idea what to do to solve this, any help would be greatly appreciated.

Posted by: michaelk Aug 15 2011, 04:31 AM

What editor are you using?

Posted by: xeron Oct 21 2011, 11:38 PM

Understand it.

Powered by Invision Power Board (
© Invision Power Services (