I have a
grep command like below to search for all
.xml files containing given string.
grep -rl 'product_list_toolbar_pager' --include='*.xml' --color=always
Now I am using this command on remote SSH terminal, where I am already inside the
/home/user/public_html/ directory path, so from the result set of the above command, how can I trim the starting folders upto which I am already inside. Means if I run the above command inside
/home/user then it should return result set containing paths starting from
public_html/ but if I run the same from inside
/home/user/public_html/ then it should return the paths starting from directory after
Now about my second need, I want to filter the result set of the above command to only contain paths which have
folder1/folder2 in their path heirarchy.
How can I acheive both these needs with minumum code as possible in SSH terminal ?