Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to view large CSV files in a terminal (not huge; simply more than can be displayed in the terminal window at once).

The best solution I've currently got is this:

column -s, -t -n < data.csv | less -S

It works well, but I'd really like to be able to split the window, so the header row of the csv will always be visible (and stay aligned with horizontal scrolling).

share|improve this question
    
I can almost imagine doing this in vi - I can't get it to open with the correct split, and haven't found a "horizontal scrollbind" to work with :set nowrap. –  Andrew Wood Apr 30 '13 at 18:00
    
How about vim's split? And is LibreOffice an option? –  ott-- Apr 30 '13 at 18:13
    
@ott: vim's split would be perfect, except for the horizontal scrollbind in my above comment. Also, I couldn't figure out if it's possible to open it pre-split from the command-line –  Andrew Wood Apr 30 '13 at 18:15
    
@ott: LibreOffice is what I currently use, but it's a lot of heavy lifting for a quick browse around a csv. –  Andrew Wood Apr 30 '13 at 18:16

2 Answers 2

As far as I know, there is now way of doing this in bash. Why don't you just open two terminals, align them and open the file in each. That way you would see the header in one and be able to scroll in another.

I highly recommend terminator a very powerful terminator emulator with the ability to split panes. What you want to do would really be easy there, just split a window horizontally and open the document in both resulting shells.

share|improve this answer
    
Ideally this is quick way to open and look at a csv. If it's going to take any thinking, I might as well just open it OpenOffice. –  Andrew Wood Apr 30 '13 at 17:59
    
Not much thinking @AndrewWood , if you are running terminator it would consist of column -s, -t -n < data.csv | less -S then Ctrl+E to split the teminal, Up and enter to run the last command. Quite quick really. –  terdon Apr 30 '13 at 18:05
    
I'll see if I can convince my sysadmin to install terminator ;) –  Andrew Wood Apr 30 '13 at 18:06
    
This has the same problem as I was having with vim. When I scroll horizontally, the column headers go out of alignment. –  Andrew Wood Apr 30 '13 at 18:53

Terminal.app on OS X allows you to split the window and scroll both parts individually. This doesn't work well with apps that scroll themselves though, like less.

Screenshot

CSV sample data taken from here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.