[SOLVED] How to display a CSV file in a nice format?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a python program that issues the LINUX "gedit" command to open up a csv file for display.
The gedit command opens up a window and displays the file, but the output is hard to read.
Is there some other editor that can use to open up a csv file and display it nicely?
You should definitely give "tad" a try. Tad = tabular data viewer. https://www.tadviewer.com/
I use it for ridiculously big (multiple millions of lines) csv files and it runs smoothly.
I decided to go with Libreoffice. It's like Excel for LINUX.
Works ok with CSV files but it has an annoying import dialog box.
I guess I can live with it for now.
Thanks for your help.
I would have though LibreOffice was a massive over-reach - a sledgehammer nut-cracker.
And really, for a site-specific problem what is the issue with using gawk ?. I long ago gave up fretting about POSIX compliance - I need solutions that work in my environment, not some "feel-good" resolution. Anything that makes my life easier is good. Gotta get into miller tho', I love the look of that as I've said before.
With a tab-delimited file or certain types of comma-separated values, it is doable with AWK. In some cases it is even easy. But when you start getting quotes and commas in the data itself, it quickly becomes a very difficult task for AWK.
With a tab-delimited file or certain types of comma-separated values, it is doable with AWK. In some cases it is even easy. But when you start getting quotes and commas in the data itself, it quickly becomes a very difficult task for AWK.
Perhaps you can use a combination of substitution and sed commands to get around the tabs and quotes? From your sample, it seems like separating by commas is possible.
Answering my own challenge . Well, it is possible to do this particular transformation on this particular set of input data with sed. Moreover, throwing wc and pr into the mix, I could do it even on a multi-line set. Not that I would really like doing it in this manner:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.