![]() |
Terminated by signal 13
Happy New Year Everyone!
I wrote a single line to search for any file that was modified/created on a certain date. To be cleared, as soon as it finds one file (any file) quit searching; here is the line: find . -exec stat -c "%y %n" '{}' \; | cut --delimiter=' ' -f1,4 | grep -m 1 2011-01-01 I get what I want, but as soon as it finds the first one it quits and it spits out many many lines of "find: `stat' terminated by signal 13". What is wrong with my one-line command? And, can anyone help me correct this line so I only get one line output without the "find: `stat' terminated by signal 13"? Thank you in advance. Bellsal |
broken pipe
Hi,
since you tell grep to quit after its first match the pipe is also closed. And that is exactly what signal 13 means: Broken pipe: write to pipe with no readers Here is a working example how to find all files that were modified on 1/Jan/2011 Code:
find /path/to/search -newermt 2011-01-01 \! -newermt 2011-01-01 -printf '%Td-%Tm-%TY %p\n' -quitman find for more options on the output format. PS: I am not sure, if the '!' has to be escaped as I did in my example. On my bash it works with an escaped '\!' as well as unescaped '!'. |
Thanks CRTS,
One last question, I don't have "-newermt" as an option to the "find" command. Are you using a different version of "find"? My version is "GNU find version 4.1.20". bellsal |
Hi,
I just looked into the manpage. The -newerXY feature was first implemented in version 4.3.3. Can you upgrade your 'find'? If not we'll have to look for a workaround. |
One more question, if upgrading is not an option:
Does your 'find' have the -newer option implemented? If yes, then here is a possible workaround: Code:
touch -m -d "2011-01-01" dummy1.tmp |
Ok,
been reading the man-page. As it appears the '-quit' option is also not implemented in your version. However, I discovered that find does not spit out an error message when it encounters a broken pipe but simply quits. So the following is probably a good option for you: Code:
find ../ -printf '%Td-%Tm-%TY %p\n' | grep -m 1 '^01-01-2011' |
CRTS,
You have been a great help. Your last suggestion is the one that works for me. Thanks, bellsal |
| All times are GMT -5. The time now is 04:19 AM. |