Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

word wrap with more / less

Status
Not open for further replies.

jimineep

Technical User
May 16, 2006
20
GB
is there a way of using less to open a file with no word wrap, ie with horizontal scrolling? Im sure there is but 'man less > grep "wrap"' doesnt seem to bring up anything. Apologies if this is the wrong forum!

Many thanks

Jim
 
Word wrap and side to side scrolling is a function of your terminal, or terminal emulator, not the command outputting text.

Some commands might be sensitive to screen width based on either an environment variable or [tt]stty[/tt] settings. Some of those could be truncating the line to what the expected screen is. I think [tt]vi[/tt] does this since it needs to use the full screen.

Most commands that just stream their input and output (things that can be used in a pipe like more/less, grep, etc) don't care and output an entire line, no matter how long it is.


 
Have a look at the --chop-long-lines or -S less options.

If your terminal supports it, you can move up, down, left and right using less, and the above option prevents it from wrapping.

Annihilannic.
 
I mean to say "using the cursor keys in less" but lost some words along the way.

Annihilannic.
 
[tt]fold -s -w80 /path/to/your/file|more[/tt]
or
[tt]fold -s -w80 /path/to/your/file|less[/tt]


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top