Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More PID and GREP Question 1

Status
Not open for further replies.

jmanj

Programmer
May 20, 2003
298
US
The following ksh script display all active ScanFileClient jobs
in the system. want to add more functionality to this script by adding a line number to all displayed jobs.

Any help is greatly appreciated.

ps -ef|grep -n ScanFileClient|grep -v grep|tr -s ' '|cut -d ' ' -f 3,11,12|xargs -n1 -i echo {} Active


This help me monitor how many a particular jobs are running.
 
You can try something like this:
ps -ef | awk '/S[c]anFileClient/{
printf "%3d) %s\t%s\t%s Active\n",++i,$3,$11,$12
}'

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
if you get a look to grep options there's specifically one which prints number of line in which a pattern has been found ... ooops ... it's the "-n" flag.
so your command could be changed in:
ps -ef|grep -v grep|grep -n "ScanFileClient" ....blah blah blah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top