Discussion Locked

View all of a column of screen output

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I would like to view all of the second column of output that appears on the screen. Right now column 3 covers part of the output of column 2. It looks something like this:

COLUMN1 COLUMN2 COLUMN3
Chris Rock 35
Kevin Spacey42
Arnold Schwarzene45

I can't figure out a how to see the full output of column2. Thanks for any help you can provide.

11 replies

by cp409sd

This example looks funny because it stripped away my spacing that made each column line up. Image that the begining of each word lines up with a column.

by cp409sd

This is just command line. As if the output was from an ls -l command. It is just shell. Specifically, bash.

by torque_rider

If it's due to wrapping past the edge of the screen, try redirecting the output to a temporary file.

ls -l > temp.txt

Then you can simply edit temp.txt with vi, pico, joe, jed, or whatever.

If you only want column 2, you'll need to be sure that you can uniquely identify column 2 with a delimiter (such as a comma (,) space, or tab. If column 1 has spaces in it sometimes, you'll get screwed up trying to get column 2. Then use this command to run your program and pipe its output throughawk to extract column 2.

ls -l | awk '{print $2}'

To specify a comma separator:

ls -l | awk -F, '{print $2}'

Thanks,
torque-rider

by shanghai sam

Thanks for the help. Unfortunately, none of these commands worked for me. I played around with them, but no luck. It still seems that even when I pipe it through awk, or redirect it to a file, the second column is still getting cut off and I don't know how to expand the column large enough to fit the full output. It is just space separated, by the way. Thanks for any other suggestions you can provide.

by m3

I suspect you are trying to get ls to show long user names. I don't think this is possible.
Try something like:

find . -maxdepth 1 -printf "%u %p\n"

by cp409sd

What I was actually trying to do was a 'netstat -r' to see my routing table, and the full domain name for the Gateway column is not showing up. I would like to know how to see the whole entry instead of it getting trucated. Thanks for thehelp.

by shanghai sam

try this:
netstat -r -n
will give you the IP instead of the truncated name
then
arp -a will get you the full name

perl can be used to manilulate the inet addresses if you wish

This discussion is closed to new replies.