заменяют
running="$running $pid"
на
running="$running,$pid"
В первом случае ps вызывается с
ps -p 12 34 45 -o pid=
, во втором
ps -p 12,34,45 -o pid=
Если я правильно понимаю вопрос, вы можете сделать это
awk '{for(i=0;i<$NF;i++)print $1,"1\n"}' file
, нашел более короткий путь
awk '{while($2--)print $1,"1\n"}' file
Попробуйте
awk '{ for (i=$2 ; i ; i--) printf "%s 1\n",$1 ; } ' < text
Где
- `for (i=$2 ; i ; i--)` is a loop that starting from second field value decrease to 1
- `printf "%s 1\n",$1` print first field with a 1