I have a command that outputs as follows:
# lostjobs
user1 12983 1 0 Feb04 ? 00:00:00 dbr UT:msmenu
user1 18253 1 0 Feb09 ? 00:00:00 dbr UT:msmenu
user2 22337 1 0 Feb09 ? 00:00:00 dbr UT:msmenu
user3 7164 7123 0 06:52 pts/0 00:00:10 dbr UT:msmenu
I know I can grab the ones with what I want to kill (which are the ones with question marks) with:
# lostjobs | grep ?
what I need to know is how can I loop through the results of the second one and kill them by id (the second column). I am not great with writing scripts for linux, so go easy on me.
Thanks for any help.