Unix command error

when i try this command i get the correct path

find /home/*/*/*/*.log

      

result

 /home/blross23/karthi/mmw/sample.log

      

But when I try this command

find /home/*/*/*/*.log -mtime +1  -type f -size +2  -printf "%s %h%f\n"

      

As a result, I get

7950 /home/blross23/karthi/mmwsample.log

      

where at the end of the path "/" (mmwsample.log) is missing between the two directories

correct path: /..../ mmw / sample.log What I get is /..../mmwsample.log

What is the mistake in the team ???

+3


source to share


1 answer


Define the format in your command:

find /home/*/*/*/*.log -mtime +1 -type f -size +2 -printf "%s %h%f\n"



You specifically tell him to print these two values ​​without the "/" between them. To fix this try:

find /home/*/*/*/*.log -mtime +1 -type f -size +2 -printf "%s %h/%f\n"

+2


source







All Articles