I'm doing:
less -S my_database_dump.sql
In order to see the files with the lines chopped (i.e. line wrapping.) But it's not working, the lines aren't being wrapped and I need to scroll horizontally to see the entire line. What can I do?
|
Try this:
If you really want lines chopped (in this example, keep the first 80 chars) instead do this:
|
||||
|
|
|
"chop" means truncate (discard remainder of line) not fold (put remainder at start of next line). The documented behaviour of the -S option to less is to do the opposite of what you describe.
-S or --chop-long-lines
Causes lines longer than the screen width to be chopped rather
than folded. That is, the remainder of a long line is simply
discarded. The default is to fold long lines; that is, display
the remainder on the next line.
(I think of Try omitting the -S option.
$ wc longlines.txt
9 128 726 longlines.txt
$ less longlines.txt
WHAN that Aprille with his shoures soote The droghte of Marche hath perced to th
e roote,
And bathed every veyne in swich licour, Of which vertu engendred is the flour;
Whan Zephirus eek with his swete breeth Inspired hath in every holt and heeth
The tendre croppes, and the yonge sonne Hath in the Ram his halfe cours y-ronne,
And smale fowles maken melodye, That slepen al the night with open ye,
So priketh hem nature in hir corages: Than longen folk to goon on pilgrimages,
And palmers for to seken straunge strondes, To ferne halwes, couthe in sondry lo
ndes;
And specially, from every shires ende Of Engelond, to Caunterbury they wende,
The holy blisful martir for to seke, That hem hath holpen, whan that they were se
ke.
longlines.txt (END)
$ less -S longlines.txt
WHAN that Aprille with his shoures soote The droghte of Marche hath perced to th
And bathed every veyne in swich licour, Of which vertu engendred is the flour;
Whan Zephirus eek with his swete breeth Inspired hath in every holt and heeth
The tendre croppes, and the yonge sonne Hath in the Ram his halfe cours y-ronne,
And smale fowles maken melodye, That slepen al the night with open ye,
So priketh hem nature in hir corages: Than longen folk to goon on pilgrimages,
And palmers for to seken straunge strondes, To ferne halwes, couthe in sondry lo
And specially, from every shires ende Of Engelond, to Caunterbury they wende,
The holy blisful martir for to seke, That hem hath holpen, whan that they were s
longlines.txt (END)
|
|||||||||
|
-Sswitch doesn't seem to work as expected because your terminal emulator reports too many columns, so less chops to the wrong size. – Eduardo Ivanec May 5 '11 at 16:33