Somehow, I did not found this a bit earlier, but now has been found. What I did not understand was actually the "ag" command and functions that could be used but now it's ok.
I will share the answer here just in case someone might need it. In order to replace the find command as I questioned previously, we can use this:
ag --php -l 'x29' "/www_root/myfile"
Output of the previous command would be something like:
/www_root/myfile/menus.php
If it found more files, then it will list files separated by new line "\n":
/www_root/myfile/menus.php
/www_root/myfile/contents.php
If you would like to know which line numbers, you can then drop the "-l" attribute and then replace it with "--numbers":
ag --php --numbers 'x29' "/www_root/myfile"
Output:
30:matches string found here
89:matches string found here
Ok, now we can combine it with "cut" command to get only the line numbers:
ag --php --numbers 'x29' "/www_root/myfile" | cut -f1 -d:
Output:
30
89
Most of the commands are similar to "ack", so for you who wants to use "ag" can find "ack" documentation as they have documented everything.
Last but not least, if you would like to know the statistic, you can add --stats to the above command as the following:
ag --php -l --stats 'x29' "/www_root/myfile"
That simple command will output as the result shown:
31 matches
1624 files searched
18686162 bytes searched
0.094022 seconds
So, yes, choosing The Silver Searcher was the right choice. That's all and have a great day.