While looking for how to filter command in
top console, I found the answer.
top -c -p $(pgrep -d',' -f string_to_match_in_cmd_line)
It works perfectly.
I think It is the same as the command
pgrep -d ',' -f cmdStr | top -c -p because they will work to feed the output of
pgrep to input of
top at least I think.
However, as you expect it returns an error
top: -p requires argument
What is different between them?