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.

  • Why not Vim? – Gilles 'SO- stop being evil' Jul 23 '14 at 22:48
  • @Gilles, because of the large (few GBs) size, which from my experience Vim cannot handle very well. – syntagma Jul 23 '14 at 23:04
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.
  • 1
    You can also type -S from within less – Stéphane Chazelas Jul 23 '14 at 8:57
  • See also the most pager that doesn't wrap by default. – Stéphane Chazelas Jul 23 '14 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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