Hope you are having a good day.
The intention is to write the PIDs of some of the running processes into an array for further use.
Function()
{
declare -a arr
ps -e -o pid,%mem,command |
awk -v val="$1" '{if($3 == val) print $1,$2,$3; $arr+=($1)}'
}
It seems I can't have access to arrays/variables inside awk.
I'd appreciate any help!