0

I have a problem when I did a file search with the script below, it looks in all the sub-directory instead of just EXPLOIT, I can not find or is the error ?? if anyone can help me? thank you

#send.sh 20160824 1500 20160825 1900

in send.sh :

find data -type d -name "EXPLOIT" |
awk -v start=$1 -v end=$3 -F/ '$3>=start && $3<=end' |
xargs find -type f |
awk -v start=$1$2 -v end=$3$4 -F/ '
{
 t=strtonum($5)
}
t>=start && t<=end {
print
}'

it searches EXPLOITNONE not just EXPLOIT

./data/20160824/EXPLOIT/201608241555-toto.tz
./data/20160824/EXPLOIT/201608241540-toto.tz
./data/20160824/EXPLOITNONE/201608242140-totoNONE.tz
./data/20160824/EXPLOITNONE/201608241550-totoNONE.tz
MAx
  • 1
  • 2
  • 3
    How about you also describe what you're trying to do? Piping 2 `find`, 2 `awk` and `xargs` looks like your design is really really wrong. – gniourf_gniourf Sep 28 '16 at 10:03
  • If this is not a duplicate, please explain its relationship to [your earlier question](http://stackoverflow.com/questions/39642897/need-help-achieve-a-file-viewing-script). – tripleee Sep 28 '16 at 10:43
  • `find` traverses directories; that's what it does. If you don't want that, use `-maxdepth 1`. – tripleee Sep 28 '16 at 10:45
  • I want to search for files by date and time in different directory – MAx Sep 28 '16 at 12:58

0 Answers0