Posted By

wolfie on 05/06/08


Tagged

Shell Bash ps awk


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

alexxx


Determine which number out of a list is being processed at the moment


 / Published in: Bash
 

Useful if you have a shell script running lots of the same command and want to know how many of them have been done

  1. Note that this works for a shell script that runs a perl script with a parameter (see related tip)
  2.  
  3. batch_name is the name of the perl script that is being run. This can be abbreviated to whatever will uniquely identify it in grep
  4. param_file is the name of the file that parameters are taken from. This needs to be the full name (e.g. param_file.txt)
  5.  
  6.  
  7. ps -ef |grep batch_name |awk '{print "grep -n " $10 " param_file"}'|sh

Report this snippet  

You need to login to post a comment.