I have to find out a file name which calls the following sql script "abhishek_to_sdw.sql". In other words it contains a pattern like "abhishek_to_sdw.sql".
I have found out using "find" command that the file abhishek_to_sdw.sql is existing on the server.
I have a sql script (abhishek_to_sdw.sql) which is called by some unix shell script file. I dont know which shell script calls this sql script and I want to find that shell script.
Please help me how to find a file with a pattern. which in this case is "abhishek_to_sdw.sql".
If your grep understands the -r flag, just use that.
fgrep -r abishek_to_sdw.sql /
Or with find,
find / -type f -exec fgrep abishek_to_sdw.sql /dev/null {} \;
Or with xargs,
find / -type f -print0 | xargs -r0 fgrep abishek_to_sdw.sql
The find -exec is the least efficient, but somewhat more portable than the others, which depend on GNU-like features. (You can avoid that in the xargs command by taking out the zeros.)