find `pwd` -type f -name "*.ksh" -exec grep -H ".ksh" '{}' \; -print 2>/dev/null
On Executing this command , the result is
/home/edwprod/Partner_com/bin/edw_etl_job_load.ksh:# Program Name : edw_etl_job_load.ksh
/home/edwprod/Partner_com/bin/edw_etl_job_load.ksh
/home/edwprod/Partner_com/bin/exec_housekeep_main.ksh:# Program Name : exec_housekeep_main.ksh
/home/edwprod/Partner_com/bin/exec_housekeep_main.ksh:# Called program : exec_housekeep.ksh
/home/edwprod/Partner_com/bin/exec_housekeep_main.ksh:#!/bin/ksh
/home/edwprod/Partner_com/bin/exec_housekeep_main.ksh: nohup ${SHELL_DIR}/exec_housekeep.ksh ${ROOT_ID} ${PLAN_ID} ${P_ACTION} ${LVL} &
/home/edwprod/Partner_com/bin/exec_housekeep_main.ksh
/home/edwprod/Partner_com/bin/retrive_pwd_edw.ksh:# echo " USAGE=> filename.ksh appl_schema"
/home/edwprod/Partner_com/bin/retrive_pwd_edw.ksh
/home/edwprod/Partner_com/bin/exec_pr_truncate_hkp.ksh:# Program Name : exec_pr_truncate_hkp.ksh
/home/edwprod/Partner_com/bin/exec_pr_truncate_hkp.ksh:# Calling program : exec_pr_truncate_hkp.ksh
/home/edwprod/Partner_com/bin/exec_pr_truncate_hkp.ksh
/home/edwprod/Partner_com/bin/exec_pr_post_housekeep.ksh:# Program Name : exec_pr_post_housekeep.ksh
/home/edwprod/Partner_com/bin/exec_pr_post_housekeep.ksh:# Calling program : exec_pr_post_housekeep.ksh
/home/edwprod/Partner_com/bin/exec_pr_post_housekeep.ksh
The command searches all the shell scripts and find the name of scripts being called inside. I need to exactly fetch the ksh name alone from this result. Please help on this?
You could give this a shot (
-Eis for extended regex,-ois for the output only matching pattern):To get a unique list:
Hope this helps!