Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to find files based on content and sender, receiver based date range provided

More details below:

Find files between date range (where folder names are the dates in the format yyyyMMdd) and file content. The folder structure is as below:

/opt/test/work/yyyyMMdd/<senderName>/TransactionID/<receiverName>/<functionname>/<functionname>/<filename>

/opt/test/work/20131112/ABC/ffd88858-6104-449e-bd41-6cba4d6a255a/XYZ/PI/split/1_ANS213.dat

Here is the command I used find . -path "//ABC//XYZ/" -newerct 20131107 -not -newerct 20131111 -exec grep -iFl 'COMMENTS' {} + | sort | uniq | awk -F/ '{print }' | sort | uniq

The above command is giving the results but as I am using the -newerct if the folder 20131101 with modified timestamp to Nov 08 2013 I am also retrieving the other files part of this folder. The problem is I just need to search the files based on folder name where the name is actually a date.

share|improve this question
    
find . -path "/*/ABC/*/XYZ/" -newerct 20131107 -not -newerct 20131111 -exec grep -iFl 'COMMENTS' {} + | sort | uniq | awk -F/ '{print }' | sort | uniq –  Kishore Bandi Nov 12 '13 at 11:28
    
The above command is giving the results but as I am using the -newerct if the folder 20131101 with modified timestamp to Nov 08 2013 I am also retrieving the other files part of this folder. The problem is I just need to search the files based on folder name where the name is actually a date. –  Kishore Bandi Nov 12 '13 at 11:31
1  
Please edit your question mentioning everything you already have and where the problem is. Thanks. –  slhck Nov 12 '13 at 11:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.