Search code examples
unixautosys

Autosys Job depends regular expression


I am using the Jobdepends command to get a list of jobs stating with tax_check_d_% I need files like tax_check_d_job but it returns tax_check_djob tax_check_d_job tax_check_djob_job

how can i select only tax_check_d_job?


Solution

  • When used in a job filter, the _ (underscore) character is a wildcard that matches exactly one character. This explains why you are seeing the unwanted results coming back -tax_check_d_job_% is essentially the same as tax_check_d_job%.

    Unfortunately I don't think there's a way around this - according to the Autosys 4.0 reference guide, the SQL ESCAPE option is not supported for wildcards.

    I would suggest adding one more character onto your search criteria to filter out the unwanted results, running the command multiple times if necessary. E.g. run it with tax_check_d_job_a%, tax_check_d_job_b%, ... as necessary.

    You could also use some custom code to strip out the results you don't want to see. Depending on your needs, this could be a simple as

    job_depends -d -J tax_check_d_job_% | grep "tax_check_d_job_.*"