Re: ps and AIX field descriptors
On Fri 17 Feb 2023 at 11:30:43 (-0500), Greg Wooledge wrote:
> On Fri, Feb 17, 2023 at 09:20:34AM -0600, David Wright wrote:
> > On Fri 17 Feb 2023 at 10:05:20 (+0300), Reco wrote:
> > > So, to answer your question - currently the only way to restore the
> > > behaviour you want is to patch procps and rebuild it.
>
> Fabulous analysis.
>
> > Or, depending on the context, you could of course restore
> > the appearance of the output with sed:
> >
> > $ ps -eo '%p %C' | sed -e 's/\([^ ]\+\) /\1|/;'
> > PID|%CPU
> > 1| 0.0
> > 2| 0.0
> > 3| 0.0
> > 4| 0.0
> > 6| 0.0
> > [ … ]
>
> Eww, GNUisms.
I don't keep a list of differences to hand, but I guess you'd prefer:
$ ps -eo '%p %C' | sed -E 's/([^ ]+) /\1|/;'
PID|%CPU
1| 0.0
2| 0.0
[ … ]
> That aside, a workaround like this is ugly and should
> not be needed.
The OP wrote: "How can I restore the previous behaviour that
allowed other than whitespace separators between fields?"
If that's the required format, what are the alternatives?
> This sounds like a bug in procps that should be reported,
> if it hasn't already.
And how long before it's fixed?
As for whether it /is/ a bug, I guess that depends on the
interpretation of somewhat in "This ps supports AIX format
descriptors, which work somewhat like the formatting codes
of printf(1) and printf(3)." That's beyond my pay-grade.
Cheers,
David.
Reply to: