Text in terminal window not wrapping

I checked the prefs for the terminal window and wrapping is on however... nothing wraps. It's been a few years since I've gotten my hands dirty with a *NIX command line but I never remember this behavior... If I type a command like...

ioreg -l | grep IOBatteryInfo

... anything that doesn't fit on the terminal just falls off the screen instead of wrapping. If I expand the size of the terminal, type the command and then resize it so that it's small everything wraps, it's just when actually running a command that it doesn't. Is there a way to change this behavior with the OSX terminal?

Cheers, Joe

Posted on Sep 13, 2005 9:56 AM

Reply
7 replies

Sep 15, 2005 3:54 AM in response to Joseph Ciarcia

Hi Joe,

> Unfortunately the -w argument clips the text, it doesn't
actually wrap it


DId you provide a numeric argument to the "-w" option as specified in the man page? On mine, using Apple's Terminal, if I execute "ioreg" with no argument, it prints 79 characters of output for each line and a dollar sign, '$', in the 80 th column to indicate that truncation has occurred. (My terminal window is 80 characters wide) If I execute "ioreg -w 82", it produces 82 characters of output for each line. The 81 st character of is wrapped to the first character of the next line and a dollar sign follows that to indicate truncation. The output actually looks kind of cool; every other line consists of one character and a '$' character. If I execute "ioreg -w 0" I see the entire output for each line, each wrapped across two lines in the Terminal, and no dollar signs.

If I enlarge my Terminal window to a width of 81 characters, executing "ioreg -w 83" again produces one character of output and a '$' character on every other line. Executing "ioreg -w 0" again produces the entire output correctly wrapped after the 81 st character.

In all tests above, ioreg was both aware of the width of my Terminal window and wrapped the text exactly as I specified. The above tests produced the same results on my 10.4.2 system and a 10.3.8 system. Were your tests performed on the 10.4 system listed in your profile?

Were your failing tests performed in Apple's Terminal? The shell I used for these tests was zsh, my default shell. Were your failing tests performed in bash? If bash is somehow causing your ioreg to fail to function properly, then that could be the best argument yet for switching to zsh! To quote Bill Scott in Why is my Default Shell 'tcsh'??:

Behold, for zsh is the only true shell. All others are false prophets.

Preach it, brother! and then convert to it.

EDIT: Rats! On my system, "ioreg" functions correctly when used in bash, producing the same results I described above. Please forgive my disappointment but this could have provided significant fuel for our "zsh evangelism". Were you using Apple's Terminal? I'm running out of theories for why ioreg, which seems to have excellent terminal awareness and wrapping capability, is failing so miserably on your system!
--
Gary
~~~~
<SlayR> i just bought MS Office 2000 for only $20!!!
<Knghtbrd> you got ripped off ;>
<SlayR> i know 😉

Sep 14, 2005 7:37 AM in response to Joseph Ciarcia

Hi Joe,
I didn't know about the "fold" utility, thank you very much Boyd! However, you should test suggestions if possible. Unfortunately "fold" doesn't help, it's "ioreg" that's clipping the output. It seems to be set to clip the output at 80 characters by default. On the other hand, you know the old addage: RTFM. "Ioreg" has a -w option and if you give it an argument of 0, it will output the entire line and wrap it.
--
Gary
~~~~
Everyone is entitled to my opinion.

Sep 15, 2005 7:22 AM in response to Gary Kerbaugh

I'm running out of theories for why ioreg,
which seems to have excellent terminal awareness
and wrapping capability, is failing so miserably
on your system!


Uhhh... I have a theory... the driver needs to start drinking coffee or get less stupid or... something. LOL Yeah it works. Now pardon me while I go extract this bullet from my foot. D'OH!

Thanks for being patient with me.

Cheers, Joe

Sep 15, 2005 8:37 PM in response to Joseph Ciarcia

Hi Joe,
That's hilarious and I know what you mean. Sometimes it's all I can do to get my foot out of my mouth before I shoot myself in it! 🙂 The main thing is that it works, yeah! I was distressed because "ioreg" appears to be one of Apple's better utilities in terms of terminal awareness. One wants the better gems in the jewelry to shine most brightly.

The most important lesson to be taken from this is the value of the man pages. At best they are spartan and at worst, cryptic in their descriptions of what's going on. However, they are usually pretty good at specifying syntax. It takes a while to get comfortable with the notation of descriptions of syntax but the wider one's repertoire of UNIX utilities, the more dependent one becomes on the man pages for the intricacies of syntax. A foot in the mouth doesn't leave much room in the head.
--
Gary
~~~~
Adding features does not necessarily increase
functionality -- it just makes the manuals thicker.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Text in terminal window not wrapping

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.