That just leaves me with:<br><br> 1 <a href="http://search.pl">search.pl</a><br> 1 <a href="http://search.pl">search.pl</a><br><br>No PID.<br><br>My earlier way is working, even if it's a for loop.<br><br><br><span style="font-family: courier new,monospace;">for i in `pgrep laFind.pl`</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">do</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># echo "Looking at PID: $i"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ppid=`grep 'PPid:' /proc/$i/status | cut -f2 -d":" | sed 's/[\t]//g'`</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if [ $ppid -eq 1 ]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> echo "Found parent PID: $i"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> echo "Child PIDs: `ps -o pid --ppid %i | sed s/[\n]/,/g`</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> fi</span><br>
<br>Only issue I'm running into is removing newlines from a list and inserting a comma. I have searched a lot for this and I swear I've done it before with sed:<br><br><span style="font-family: courier new,monospace;">sed 's/\n/,/g'</span><br>
<br>But it doesn't work. Neither does \n\r, \r or using a $. Using the $ just sticks a comma at the end of each line.<br><br><br><div class="gmail_quote">On Tue, Jan 25, 2011 at 1:11 PM, John Van Ostrand <span dir="ltr"><<a href="mailto:john@netdirect.ca">john@netdirect.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">----- Original Message -----<br>
> Ah! /proc/<PID>/status and look for 1 under PPid:, when you find all<br>
> the ones that have to do with <a href="http://search.pl" target="_blank">search.pl</a> and have a 1 for PPid, we're<br>
> all set.<br>
<br>
</div>Now that I'm back at a computer this would work too:<br>
<br>
ps -e -o "%P %c" | grep -E "^ +1 " | grep <a href="http://search.pl" target="_blank">search.pl</a><br>
<br>
Then pipe through sed or cut to get just the PID.<br>
<br>
--<br>
John Van Ostrand<br>
CTO, co-CEO<br>
Net Direct Inc.<br>
564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6<br>
Ph: 866-883-1172 x5102<br>
Fx: 519-883-8533<br>
<br>
Linux Solutions / IBM Hardware<br>
<div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
kwlug-disc mailing list<br>
<a href="mailto:kwlug-disc@kwlug.org">kwlug-disc@kwlug.org</a><br>
<a href="http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org" target="_blank">http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org</a><br>
</div></div></blockquote></div><br>