Sample Header Ad - 728x90

Perl script to format .xls file in Linux

0 votes
1 answer
1130 views
All I have is a linux command (I don't know what's behind the command, the script or what formats the command output), so what I can do is to pull the data [which is in table form with invisible column lines], out from linux, and send it out to people for reviewing purpose. When I run the command, the generated output are nicely formatted in aligned columns on my console screen, even when I put it into diff types of file extension: .txt / .csv / .xls (they are all nice in linux terminal) > thatCommand | mail -s 'Statistics' my@email.com Above: print output as message body in the email Below: redirect output to a file and send it out as attachment in email > thatCommand > stat.xls > uuencode stat.xls table.xls | \mail -s "Statistics" my@email.com Then, I have this problem, after executing the first command line, the table in my message body is shown like below > Student Name ID SubjectA(%) SubjectB(%) > Aaron Frank 7892 89 100 > Benjamin Ayres 8892 78 90 How I would like it, to be arranged according to columns: Student Name ID SubjectA(%) SubjectB(%) Aaron Frank 7892 89 100 Benjamin Ayres 8892 78 90 So I tried 2nd command lines with attachment instead. After receiving those different types of file extension attachment in mail, save and open them in windows. (in my PC, csv and xls are by default open by excel, txt open using notepad) The output supposed to be in different columns (it's a table in linux before I exported it), but instead all the data is in the first column, looking messy in excel application. [looking messy in notepad too] The below image is my endgoal, data values in different columns (well aligned) how it supposed to look like, how I expect it how it looked like now, the data are all in columnA only how it looked like now Is perl script able to help? So that I could get the nicely formatted output when received the attachment? I wouldn't mind because I still have to add some info at the end of the excel file in linux. (even though I have yet to figured out how to do that), but for now my main concern is on how to format it :) This is the [link](https://unix.stackexchange.com/questions/355271/run-multiple-commands-and-put-into-different-excel-worksheets) question what would be further done.
Asked by Santa (17 rep)
Mar 20, 2017, 02:22 AM
Last activity: Jan 13, 2019, 10:17 PM