The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
List services running in UNIX JanSP UNIX for Dummies Questions & Answers 2 03-21-2007 01:45 PM
grep a list of values jolan_louve Shell Programming and Scripting 3 12-06-2006 02:18 AM
how to get the list of process running in the server from the local machin n unix ? guhas Shell Programming and Scripting 3 10-04-2005 03:58 PM
need to grep or egrep the running processes in C file jimmynath UNIX for Advanced & Expert Users 5 09-08-2005 04:26 PM
How will you list only the empty lines in a file (using grep) JosephGerard UNIX for Dummies Questions & Answers 1 07-21-2005 03:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-20-2007
marconi marconi is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 41
Can we grep a list of all running PIDs in a file !!??

Hi,

In the following part of a script, I am grepping the list of all
running PIDs in the File as in line 3 :-
$pid_count=`grep -c "^${pid_process}$" $CRI_PUSH_BIN_HOME/bin/
PushProcessId`


If I cannot grep this way, then how can I do so.


1 pid_process=`ps -ef -o pid,args | grep -v grep | grep -v $PROGNAME
| grep push | awk '{print $1}`


2 process=`ps -ef | grep -v grep | grep -v $PROGNAME | grep -c push`


3 pid_enregistre=`cat $CRI_PUSH_BIN_HOME/bin/PushProcessId`
4 no_pid_enregistre=`wc -l $CRI_PUSH_BIN_HOME/bin/PushProcessId | tr
' '`


5 found=1
6 for pid_val in "$pid_process"; do
7 $pid_count=`grep -c "^${pid_process}$" $CRI_PUSH_BIN_HOME/bin/
PushProcessId`
8 if [ $pid_count -eq 0 ]; then
9 found=0
10 pid_not_present="$pid_not_present $pid_val"
11 fi
12 done


Request you to pls lemme know .


Thanks a lot in advance.
  #2 (permalink)  
Old 12-20-2007
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Put 'CODE' tags round that to make it easier to read
What's in $CRI_PUSH_BIN_HOME/bin/PushProcessId ? Are you intentionally grepping through this file or do you want to use the contents to form your grep expression?
Line 3 looks different, do you mean line 7?

Please clarify where you believe the problem is.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0