Operating on each of the individual outputs of a command

ps -e -o pcpu,pid,cmd --sort pcpu | sed '/^ 0.0 /d'|awk '{print $2}'|grep -v PID

Gives the output:

4482
4023
5912

I want to operate on each pid in the output. How to do so.

That depends on what you want to do.

If you can do it with awk:

ps -e -o pcpu,pid,cmd --sort pcpu |
 awk '
 /^ 0.0/ || /PID/ { next }
 {
    ## do whatever with $2
}'

Or, you can do it with the shell:

ps -e -o pcpu,pid,cmd --sort pcpu |
 while read pcpu pid cmd
 do
   case $pcpu$pid in
    0.0*| *PID) continue;;
   esac
   ## do whatever with  $pid, e.g.:
   echo $(( $pid * 2 ))
 done
for PID in $(ps -e -o pcpu,pid,cmd --sort pcpu | sed '/^ 0.0 /d'|awk '{print $2}'|grep -v PID)
do
    echo "the PID is $PID" # or whatever you want to do with that PID
done