--chop-long-lines

W

wpmccormick

How can you print a line of text without line wrapping? This would be
similar to the --chop-long-lines param in less.

Thanks!
 
J

Jürgen Exner

How can you print a line of text without line wrapping?

????
Buy a printer with very wide paper? Use a tiny font? Have shorter lines of
text?

jue
 
J

Jürgen Exner

Print to the terminal

Ok, so no printer with very wide paper. But I still don't understand what
you expect to happen with a line of text, that is too long to fit on that
terminal of yours.

jue
 
K

Klaus

How can you print a line of text without line wrapping? This would be
similar to the --chop-long-lines param in less.

You should explain what you expect from "--chop-long-lines" param in
less.

Here is what I have found on http://www.computerhope.com/unix/uless.htm
==========================================
--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.
==========================================

Is that what you expect ?

If so, then one of the many possible solutions could be:

use strict;
use warnings;

# first, read in the size of your terminal (maybe you could
# use GetTerminalSize() from Term::ReadKey)

# then, process your data line by line (don't forget to
# chomp if you read line by line from a file)

# if the length of your line is greater than the size of your
# terminal, then use substr() to cut the line (you might
# even want to consider cutting down to terminalsize - 1)

# print each line with a "\n" at the end
 
M

Mumia W.

How can you print a line of text without line wrapping? This would be
similar to the --chop-long-lines param in less.

Thanks!

You can use the "substr" command:

Start->Run->"perldoc -f substr"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top