LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Other *NIX (https://www.linuxquestions.org/questions/other-%2Anix-55/)
-   -   HPUX: find command finding non-existent files (https://www.linuxquestions.org/questions/other-%2Anix-55/hpux-find-command-finding-non-existent-files-4175490364/)

arfon 01-06-2014 06:37 PM

HPUX: find command finding non-existent files
 
When I:
Code:

    find /home -type f | xargs ls -l | sort -k5 | head
I get:
Code:

    /home/bob/UC.T.DATA not found
    /home/chug/IERT.txt not found
    flemdata not found

1) Why is find finding non-existent files?

2) I added | grep -v "not found" to the command with no effect, why?

rhoekstra 01-07-2014 01:47 AM

To start with 2, probably the error 'not found' is sent to STDERR, not STDOUT. you should redirect the error to STOUT in order to filter it with grep.

that said, do the files actually exist? and if so, don't they contain 'weird' characters or spaces?

zhjim 01-07-2014 02:06 AM

Could as well be a race condition. I have no idea about the interna of file but I guess that it gets a directory listing and then lists the file of it. But if there beeing enough time between getting the listing of the directory and listing the actual file the file might all ready be deleted. Thus not found.

rhoekstra 01-07-2014 06:19 AM

How about this command:

Code:

find /home -type f -exec ls -l {} \; | sort -k5 | head

arfon 01-07-2014 04:31 PM

The files definitely do not exist.

Redirecting stderr had no affect.

find /home -type f -exec ls -l {} \; | sort -k5 | head - just sits there and I had to CTRL-C out of it...

I'll just write the output to a text file then parse the file...


MY CONCLUSION: HPUX is a POS.

Thanks for the help though.


All times are GMT -5. The time now is 01:23 PM.