I run physics analysis jobs in a computer grid. Sometime the jobs go wrong and I have to kill them (one by one) which is painful. Can you please suggest me how can I select only the numeric values (748736838 and so on) from this output:
$ps -W mhaque -748736838 0 W mhaque -748736879 0 W mhaque -748737079 0 W mhaque -748737185 0 W mhaque -748737276 0 W
(and hundred of lines like this)
I tried few
grep command (from stackExchange) but could not separate the numeric values. Is there command which can select the numeric values and also place 'kill' in front of them? For example something like this (piping):
ps -W | awk/sed/grep (what_to_use) | (some_command to place "kill") | > file.list
Which would give me the following (in file.list):
kill 748736838 kill 748736879 ...so on..
Then I can simply copy paste it in the grid shell to kill all offending/long waiting jobs.