ps output truncated


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users ps output truncated
# 1  
Old 06-09-2003
ps output truncated

Hi!

I have some shell scripts receiving in input lots of parameters and I need to select the ones having a particular value in one parameter.

A typical shell command line is:

PROMPT > shell_name.ksh -avalue_a -bvalue_b -cvalue_c -dvalue_d ...

I used a combinaton of ps and grep commands to select the right process, for instance:

PROMPT > ps -fu $LOGNAME | grep "shell_name\.ksh.*-dvalue_d" | grep -v grep

PROBLEM: if command line is too long, ps command extracts a part of it only (for instance till -cvalue_c), so grep command fails.

Consider that shell_name.ksh supports input parameters commutation, but I can't force shell users to launch script with -d parameter in first position.

FROM PGREP MAN:

SEE ALSO
kill(1), proc(1), ps(1), truss(1), kill(2), proc(4), attri-
butes(5), regex(5), signal(5)

NOTES
Both utilities match the ERE pattern argument against either
the pr_fname or pr_psargs fields of the /proc/nnnnn/psinfo
files. The lengths of these strings are limited according to
definitions in <sys/procfs.h>. Patterns which can match
strings longer than the current limits may fail to match the
intended set of processes.

So, maybe I have to use other commands. Have you got any ideas to select processes with long command-line?

Many thanks. Bye

Paride
# 2  
Old 06-09-2003
What is the OS and version?


In Solaris there is a second ps command in /usr/ucb - it has different options than the normal ps command

Normal:
$ ps -ef
UCB:
$ /usr/ucb/ps -auxw

Using the other command might help (if you have it on your OS).

And please don't post the same question twice - if you have more information, post a relpy to your question. I'm going to link your other question to this.
# 3  
Old 06-09-2003
i think you are running up against the 80 char max for line length... because your window is typically set to 80 chars

If you use the -x option it will extend your commandline for the process in question.

Here is a sample from one of my boxes.

host-root:/root/LVMcommands
# ps -aef |grep 12770
root 14462 23682 1 13:11:45 pts/td 0:00 grep 12770
applmgr 12770 12536 0 Jun 6 ? 0:17 FNDCRM APPS/879E9496000000000000
0000000000000000000000000000000
host-root:/root/LVMcommands
# ps -aefx |grep 12770
root 14476 23682 1 13:11:49 pts/td 0:00 grep 12770
applmgr 12770 12536 0 Jun 6 ? 0:17 FNDCRM APPS/879E9496000000000000
0000000000000000000000000000000000000000 FND FNDCRM N 10 c LOCK Y host1 2552
# 4  
Old 12-02-2003
Hi,

I've nearly the same problem, but when I use
ps -ef
I can see the complete anem of the process I like to kill e.g:

ps -ef

bensk 11870 1 0 14:24 pts/5 00:00:00 /opt/blahhhhhhhhhhhhhhh/bluuuuuuuub/out

If I now grep for this process

ps -ef | grep out | grep -v out --> typo, what I did for sure:
ps -ef | grep out | grep -v grep --> -v grep for avoiding grep will find its own process

I get no results. When I grep for the process number i detetced before I get the following:

ps -ef| grep 11870

bensk 11870 1 0 14:24 pts/5 00:00:00 /opt/blahhhhhhhhhhhhhhh

So I think it is a problem of grep, but I do not know how to solve this...
Please help...

THX

ben Sky

Last edited by bensky; 12-02-2003 at 10:19 AM..
# 5  
Old 12-02-2003
Quote:
ps -ef | grep out | grep -v out
You are telling it to grep for "out" and then telling it to remove any line that contains "out" - read the man page for grep.
# 6  
Old 12-02-2003
typo!!

For sure i did not grep if -v for my process...
I corrected it...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ps -ef, output getting truncated, please help

Hi All, here is an output of my command and the problem is that my output string is truncated, I want to exact the full string, I am on BASH shell, please help me out. Regards Rahul command with Output : lonss05903:cmdsvc01 /home/cmdsvc01 > ps -aef|grep 'Copy' cmdsvc01 2642 8675 ... (7 Replies)
Discussion started by: rahulkalra9
7 Replies

2. UNIX for Advanced & Expert Users

Problem piping find output to awk, 1st line filename is truncated, other lines are fine.

Today I needed to take a look through a load of large backup files, so I wrote the following line to find them, order them by size, and print the file sizes in GB along with the filename. What happened was odd, the output was all as expected except for the first output line which had the filename... (4 Replies)
Discussion started by: gencon
4 Replies

3. Solaris

ps output truncated

Hi, I have Solaris-10 server. /usr/ucb/ps auxww is showing full path if I am running it from root. But if I run it from non-root user, its output is truncated. I don't want to use any other alternate command. Please suggest, what can be its solution. Terminal is set to term. (21 Replies)
Discussion started by: solaris_1977
21 Replies

4. UNIX for Dummies Questions & Answers

output from sed getting truncated

Hi all, I have used sed command with a file of size 7KB and stored the output to another file. When i look into the output file, a few file lines at the bottom have got truncated. The sed statement i used is as below. Why does this happen and how to resolve this. SQL=`sed... (3 Replies)
Discussion started by: madhan@29
3 Replies

5. Linux

relocation truncated to fit

Hi, I am getting linking error i.e. /ade/aime_urtk/oracle/has/include/caa_ResStateListener.hxx:79: relocation truncated to fit: R_PPC_GO T16 vtable for CAA::ResourceStateListener /ade/aime_urtk/oracle/has/lib//libcaad.a(caa_Main.o)(.text+0x88e6): In function `CAA::ResourceStateL... (0 Replies)
Discussion started by: jgobbur
0 Replies

6. UNIX for Dummies Questions & Answers

File gets truncated

Hi Guys, I have a master script file. That calls the other script files. The sub script files append some of the data to the log file. Once the master script completes one sub script execution and returns to execute other sub script that appends to the same log file. the log file gets... (2 Replies)
Discussion started by: Swapna173
2 Replies

7. Shell Programming and Scripting

Truncated with a pipe?

OK, I'm stumped. I have a shell script that reads a list, and for every item in the list performs a lookup in our Active Directory. Now, it seems that when I pipe the results into grep, the complete results are not there (truncated?). I'm not sure if this is a limit of the pipe, grep, shell... (1 Reply)
Discussion started by: TheCrunge
1 Replies

8. AIX

PS truncated in AIX

folks; how can i get longer output than the one i got by using "/usr/ucb/ps awwx"? :mad: (2 Replies)
Discussion started by: moe2266
2 Replies

9. Solaris

ps truncated output

Hi Problem of ps on Solaris 8 and 9 Perhaps a silly question but I can't find a solution. the output of the command ps -ef is truncated. I've tried to change the terminal settings with stty putting a big number of colums: no change. Following the man page of ps i have set the variable... (8 Replies)
Discussion started by: renoc
8 Replies

10. Shell Programming and Scripting

ps output truncated

Hi! I have some shell scripts receiving in input lots of parameters and I need to select the ones having a particular value in one parameter. A typical shell command line is: PROMPT > shell_name.ksh -avalue_a -bvalue_b -cvalue_c -dvalue_d ... I used a combinaton of ps and grep commands... (1 Reply)
Discussion started by: pciatto
1 Replies
Login or Register to Ask a Question