who truncates the output? redirection? tty? Bug?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users who truncates the output? redirection? tty? Bug?
# 1  
Old 12-04-2006
who truncates the output? redirection? tty? Bug?

Hi,

Output of running berkeley ps is truncated to 80 chars when using redirections.
$ /usr/ucb/ps -e 12490|cat #truncated to 80 chars
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


getting longer lines is done by changing the stty
$ stty columns 300
$ /usr/ucb/ps -e 12490
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...#line is 300 char

when running with redirection and trying to get the same result by environment variables
$ set COLUMNS=300;export COLUMNS
$ echo $COLUMNS
300
$ /usr/ucb/ps -e 12490|cat #truncated to 80 chars
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

another option i tried is by setting the output in a variable (still not working):
$output=`/usr/ucb/ps -e 12490`
$echo $output
PID TT S TIME COMMAND
12490 pts/24 S 0:00 sleep 4000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


Does some knows how to overcome this problem?
How can i know what is the max size the stty columns can be define?

I have noticed that setting the stty columns higher the the length of the command and arguments (ps -e) the ps "command" line shows only the process name in brackets e.g. [java].
Thats why i am looking for the max size of the command and args.

Thanks in advance
# 2  
Old 12-04-2006
Maybe you should try reading the man page? It has stuff like:
"w Use a wide output format (132 columns rather than 80); if repeated, that is, -ww, use arbitrarily wide output. This information is used to decide how much of long commands to print."
# 3  
Old 12-04-2006
Man pages doesn't help

when running with the w option, the output returns to be 80 chars even if the stty is bigger then 80

BTW, i have this problem is on sun5.9 and 5.10
# 4  
Old 12-04-2006
# /usr/ucb/ps auxwww | grep sleep
root 13628 0.0 0.1 1216 944 pts/5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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa

that works great for me on:

SunOS aiea 5.10 Generic_118822-25 sun4u sparc SUNW,Sun-Blade-1000

cheers,
Darwin
# 5  
Old 12-04-2006
Bug can the problem be in the terminal configuration?

Hi,

Thanks for the answer.

1. what is your configuration of the stty [columns] (stty -a)?
2. what happens if you set the stty columns size bigger the the command line? does the command comes with brackets? Do you know if there is a way to avoid that?
3. Is there any COLUMNS environment variable defined?

Many questions Smilie ... i appritiate it. Smilie

Thanks again,

Fredy
# 6  
Old 12-04-2006
My column size is 80 and there is no environment variable setting it to something different. However, ps auxwww still shows me the entire command line of the process. (Whats a very useful feature when having a look at java processes ;-))

Did you ever try ps auxwww (with 3 w) ? This should work regardless of any column size settings when using the /usr/ucb/ps exec, afaik.

cheers,
Darwin
# 7  
Old 12-05-2006
You are right, with 3 www it works fine on Sun5.10.

I am afraid i made a mistake, the problem occurs on Sun5.9 only.

Does it work for you on Sun5.9?



Thanks,

Fredy
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux csh script going to Suspended (tty output) when running with & (bg)

i have strange behavior i have csh file that run java process something like this : run_server.csh #!/usr/bin/tcsh java -Dtest=testparam -cp ${TEST}/lib/device.jar:${TEST}/conf:${TEST}/lib/commons-logging-1.1.1.jar com.device.server when i run it like this :... (7 Replies)
Discussion started by: umen
7 Replies

2. Shell Programming and Scripting

Simply question about capturing output to /dev/tty

Suppose another person wrote the following one-line shell script: echo $RANDOM > /dev/tty QUESTION #1: How can the random number, which is output to the terminal by this script, be captured in a variable? QUESTION #2: How can this be done in a cron job? Specific code, whether in ksh or... (1 Reply)
Discussion started by: Paul R
1 Replies

3. Shell Programming and Scripting

output redirection

Hi all I was wondering if there was a slicker way of doing this without the file - awk '{print $2}' FS=":" "${FILE}" > "${TMPFILE}" { read M_GRP_ID || m_fail 1 "Error: Read failed 1 (${FUNCNAME})" read M_GRP_WAIT || m_fail 1 "Error: Read failed 2 (${FUNCNAME})" }... (6 Replies)
Discussion started by: steadyonabix
6 Replies

4. UNIX for Dummies Questions & Answers

Output redirection

Hello i am trying to write a script that will redirect the output to a certain file. Here is the code so far: #!/bin/bash ps -e | sort | more > psfile When I execute the script nothing happens since i assume the output was redirected to the file called psfile. When I try to look at the... (1 Reply)
Discussion started by: mfruiz34
1 Replies

5. Shell Programming and Scripting

Output redirection

We have an application here that does some table queries and then prints the result on screen. I do not have the code of this application (which i will just call "queryCommand"), but what it does is that you call it with some parameters and it prints some info about the query and then the... (5 Replies)
Discussion started by: jolateh
5 Replies

6. Shell Programming and Scripting

Redirection output

Hi there I have a script that runs but it outputs everything onto the screen instead of a file. I've tried using the > outputfile.txt however all it does is dump the output to the screen and creates an outputfile.txt but doesn't put anything in that file. Any help would be appreciated ... (6 Replies)
Discussion started by: kma07
6 Replies

7. Shell Programming and Scripting

redirection and output

I'm redirecting the output of a command to a logfile, however, if the user is on a terminal I would also like the output to be displayed on the screen. tar tvf some_tarfile >Logfile if the user is on a term then have the output to the Logfile and also be displayed on the screen at the same... (2 Replies)
Discussion started by: nck
2 Replies

8. Shell Programming and Scripting

TTY colors are screwing up my output

I have been trying to get the output of an ssh session pushed to file... the problem is that there are colors in the output, and when I view the file the colors show up as "^[00m" or other such various nonsense The weird part is that if I do this all manually, I have no problems, but if I try to... (0 Replies)
Discussion started by: jjinno
0 Replies

9. Shell Programming and Scripting

Stopped (tty output)

What is mean by "Stopped (tty output)", how can i get rid of it. (3 Replies)
Discussion started by: Chandu
3 Replies

10. UNIX for Dummies Questions & Answers

redirection to tty** with cat

I tried to cat a file to another user that was logged in, but I received an error message that displayed something like: %cat funny > /dev/ttyp3 zsh: permission denied: /dev/ttyp3 Thank you all for your help (1 Reply)
Discussion started by: zorro
1 Replies
Login or Register to Ask a Question