output of 'ps -ef' getting truncated

D

dn.perl

I am trying to grep for a string but cannot since the output of 'ps
-ef' is getting truncated to 126 characters.

my @search_arr = `ps -ef | grep -i $my_string` ;

Can I do 'ps -ef' in Perl instead to get a longer output? Or does any
switch exist which would enable me to make 'ps -ef' get truncated at
192 or 256 characters instead of just 126?

Thanks in advance.
 
J

John W. Krahn

I am trying to grep for a string but cannot since the output of 'ps
-ef' is getting truncated to 126 characters.

my @search_arr = `ps -ef | grep -i $my_string` ;

Can I do 'ps -ef' in Perl instead to get a longer output? Or does any
switch exist which would enable me to make 'ps -ef' get truncated at
192 or 256 characters instead of just 126?

man ps

Look for the -w or perhaps even the -o switch.


John
 
T

Tintin

I am trying to grep for a string but cannot since the output of 'ps
-ef' is getting truncated to 126 characters.

my @search_arr = `ps -ef | grep -i $my_string` ;

Can I do 'ps -ef' in Perl instead to get a longer output? Or does any
switch exist which would enable me to make 'ps -ef' get truncated at
192 or 256 characters instead of just 126?

Doesn't matter if you call ps -ef from a Perl script, shell script, or any
other programming language. The output length is going to be limited to
whatever the ps options dicatate.
 
J

Jürgen Exner

I am trying to grep for a string but cannot since the output of 'ps
-ef' is getting truncated to 126 characters.

my @search_arr = `ps -ef | grep -i $my_string` ;

Can I do 'ps -ef' in Perl instead to get a longer output? Or does any
switch exist which would enable me to make 'ps -ef' get truncated at
192 or 256 characters instead of just 126?

No, there is no option, flag, switch, parameter, function, operator,
command, ... in the Perl programming language that would effect what an
external program prints to STDOUT (aside of choosing a different output
channel).

jue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top