?
Solved

Bash wrap lines?

Posted on 2006-04-26
5
Medium Priority
?
1,722 Views
Last Modified: 2010-05-18
I'm trying to read the last couple of lines of a log file using a bash shell. tail -f /file works fine but for one small problem. The lines in the file are too long to display on the screen so it truncates them. I need to see the end/truncated part of the line. Is there a way to make tail do this or another program I can pipe the tail output into in order to see the entire line wrapped on screen?

Thanks!
0
Comment
Question by:albee01
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:rbvoigt
ID: 16545831
I think tail only does that when the output is a tty... try piping the result through cat.
0
 
LVL 1

Author Comment

by:albee01
ID: 16546106
Nope. No such luck. cat does the same thing. I'm connected via ssh if that helps.
0
 
LVL 4

Accepted Solution

by:
NVRAM earned 500 total points
ID: 16547138
Neither tail nor cat truncate lines, so something *else* is causing your problem.

My first guess is that it's your terminal program.  You mention SSH (which also *should* not be truncating), but don't mention how.

What OS are you running locally -- Linux (or other *UX) , Windows, Mac?
What terminal program are you using?  Putty, Gnome-terminal, xterm, etc...

Try checking the settings for the program you're using and see if you don't have line truncation set, or scroll bars suppressed.

Also, on the remote machine try this:    stty -a
which should display a number for "columns" that should correspond to what you are using locally.

If it doesn't show a number that corresponds to your system, you *could* try this, which might or might not help:
    stty columns 80  

Good luck
0
 
LVL 1

Author Comment

by:albee01
ID: 16553516
NVRAM pointed me in the right direction so they get the points. It turns out to be a setting in Putty under the terminal section ("Auto wrap lines initially on") which was not selected.
0
 
LVL 4

Expert Comment

by:NVRAM
ID: 16554345
Glad to help.  BTW, I'm a "he" not that it matters. ;-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn different types of Android Layout and some basics of an Android App.
Simple Linear Regression
Loops Section Overview

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question