[Orca-users] RE: Problem starting ORCA via SSH command

Waltner, Steve swaltner at lsil.com
Fri Apr 19 06:48:39 PDT 2002


The problem is that awk doesn't like parsing long lines. What's a long line?
How about a command line that is 11,700 characters long like when a user
runs cscope on a directory with 765 files in it like the following:

ra:~> ps auxwww | awk '/cscope/'
awk: record `mackeret  3800  0.9 ...' too long
 record number 3
ra:~> ps auxwww | grep 3800 | cut -c -200
mackeret  3800  0.0  0.0 1520 1216 pts/458  S 08:37:32  0:04
/opt/SUNWspro/bin/cscope -I ../incl -f /home/mackeret/cscope.5.21.out
DVEtestfunction.c PrintState.c acsFfs.c actTrace.c altCtl.c arrayLib.
ra:~> ps auxwww | grep 3800 | wc
       1     780   11764
ra:~> 

How should one get around this awk error message without first piping the ps
output into grep to get rid of the entries that we are obviously not
interested in.

The best solution would be to use a pgrep, but since that is only shipped
with Solaris 8 and higher, it's not a viable option for Blair. One could do
the grep and then pipe it into cut or sed or something similar, but that's
no worse that piping it into awk.

Steve


> ----------
> From: 	Peter Radcliffe
> Reply To: 	orca-users at yahoogroups.com
> Sent: 	Thursday, April 18, 2002 8:50 PM
> To: 	orca-users at yahoogroups.com
> Subject: 	Re: [orca-users] Problem starting ORCA via SSH command
> 
> Sean O'Neill <soneill at oneill.dhs.org> probably said:
> > At 12:09 PM 4/18/2002 -0700, Blair Zajac wrote:
> > >Try changing the line:
> > >pids=`/usr/ucb/ps auxww | $AWK '/orcallator.se/ && !/awk/ {print $2}'`
> > >to
> > >pids=`/usr/ucb/ps auxww | grep '[o]rcallator.se' | $AWK {print $2}'`
> > >and let me know if this stops the burps.
> > Let it be known the burps have stopped.
> 
> Script writing rule of thumb #346;
> If you are piping grep output into awk, you shouldn't be.
> 
> pids=`/usr/ucb/ps auxww | \
>                  $AWK '/[o]rcallator.se/ && $9 != "'$AWK'" {print $2}'`
> 
> If you are paranoid you can also add a;
>   && $1 == "root"
> to make sure you don't accidentally kill off a user's process that happens
> to include the name orcallator.se.
> 
> P.
> 
> -- 
> pir                pir-sig at pir.net                 pir-sig at net.tufts.edu
> 
> 
> 
>  
> 
> 
> 
> 



More information about the Orca-users mailing list