Am using the following find command to extract some files,find /lag/cnnf/ -maxdepth 3 -newer ./start ! -newer ./end | grep -nri abc | egrep '([^0-9]45[^0-9])' | grep -nri db.tar.gz >> sample.txtMy output in sample.txt is5:175:/lag/cnnf/abc/45/r-01.bac.db.tar.gz20:190:/lag/cnnf/abc/45/r-01.bac.db.tar.gzwhat should i do to get only,/lag/cnnf/abc/45/r-01.bac.db.tar.gz/lag/cnnf/abc/45/r-01.bac.db.tar.gzwithout the random numbers in front of it and what those numbers actually mean.
Pipeline with grep and find prints numbers infront of result
shell;find;grep
The numbers come from the -n options you are passing to grep. However, the pipe as you have it is a bit too long for my taste.From your example it seems you have a reasonably simple directory structure. If you have the GNU find, use -regex (I'm not sure this is mandated by POSIX):find /lag/cnnf/ \    -maxdepth 3 \    -regex abc.*[^0-9]45[^0-9].*db.tar.gz \    -newer ./start ! -newer ./end >> sample.txtOtherwise, assuming a little bit stricter requirements on the directory structure (would still fit your example):find /lag/cnnf/ \    -maxdepth 3 \    -path *abc*/45/*db.tar.gz \    -newer ./start ! -newer ./end >> sample.txtYou might also want to consider using shell expansion - for example in bash you would need to set the shell option globstar and then play with matching using the ** wildcard.