1

I am looking for a command line utility that would allow me to quickly investigate structure of a large dataset. Right now I am doing it by using: head -n 2 dataset but the problem is that the width of the output is larger than width of my terminal/screen.

What would be perfect is a tool to horizontally scroll through the file (by a fixed number of columns), the same way I can scroll through file opened in Vim by using Ctrl+f/Ctrl+b.

2
  • Why not Vim? Commented Jul 23, 2014 at 22:48
  • @Gilles, because of the large (few GBs) size, which from my experience Vim cannot handle very well.
    – syntagma
    Commented Jul 23, 2014 at 23:04

1 Answer 1

3

I would recommend less

You can browse in any direction With

less -S logfile

-S or --chop-long-lines

          Causes lines longer than the screen width to be chopped rather than folded.  That is, the portion of a long line that does not fit in the screen width is not shown.  The default is to fold long lines; that is, display
          the remainder on the next line.

For horizontal movement

ESC-) or RIGHTARROW

          Scroll horizontally right N characters, default half the screen width (see the -# option).  If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands.  While the text is scrolled,
          it acts as though the -S option (chop lines) were in effect.

ESC-( or LEFTARROW

          Scroll horizontally left N characters, default half the screen width (see the -# option).  If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands.
2
  • 1
    You can also type -S from within less Commented Jul 23, 2014 at 8:57
  • See also the most pager that doesn't wrap by default. Commented Jul 23, 2014 at 8:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .