ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know that is protocol. I am having a brain cramp on how to started to basically seperate the pids with 2 lines (pksh, ksh process) and the pids with 3 lines (pksh, ksh, process_name).
So wait. Your input data comes in paragraphs of either two or three lines, followed by a blank line. In the paragraphs consisting of exactly two lines, you want to kill the processes numbered at the beginning of each line. You want to drop on the floor the paragraphs consisting of three lines. You want to puke if a paragraph consists of fewer than two lines or more than three lines.
It returns this output. Notice I put a break between the ones that have a pksh,ksh,process and the only one that does not have all three. The very last one (in bold) that only has pksh, ksh those are the ones I need to kill off via a script.
I thought the "?" meant it was dead but it does not because I can connect to the 13794 Peek session and it has the question mark.
I need to be able to kill the second group because it has no database connection and from what we can tell it is dead. If we try and reconnect to that session id via Peek it states this session is no longer valid. The one with the db_process is able to be connected to. This would not be such an issue but we only have 1600 Peek connections and need to keep this tidy. If this was killing one process or a few I could do it by hand but it is 100's.
So how do I get my perl code to check this line:
user1 13794 13493 2010 ? 09:09:45 2011 pts/3874 -pksh-ksh
and grab the 13794 id and then check line number two in the third column for this very same number 13794 and then check the 2nd column, 2nd line id 13795 and see if it matches column 3, line3 13795.
I was told to use Proc::ProcessTable but I am not sure how to kill off the ones I want with this output.
This is above my scripting know how and it would be great if someone out there could give me some direction.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.