Greg Freemyer said the following on 02/25/2013 01:35 PM:
All,
In non-working-psuedo-find-language I want to find a command to do:
find . -name \*.E01 -exec ewfverify -l $(basename '{}').ewfverify.out '{}' ;
I much prefer the use of sign;e quotes, e.g. '*.E01' But that's one of my ideosyncracies.
Can anyone give me the right syntax. I'm not sure if it is easier to add xargs to the mix, if so that's fine too.
There's a similar quoting issue with "-exec". <quote> All following arguments to find are taken to be arguments to the command until an argument consisting of `;' is encountered. The string `{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, </quote> Where it says "The string '{}' ... Should that be single quoted when used or is that just in the context of the manual? Later, we find <quote> find . -type f -exec file '{}' \; Runs `file' on every file in or below the current directory. Notice that the braces are enclosed in single quote marks to protect them from interpretation as shell script punctuation. The semicolon is similarly protected by the use of a backslash, though single quotes could have been used in that case also. </quote> So if you are right to use '{}' on the command line then you missed out on the ';'
=== background with examples
I have common situation where I have a parent folder with multiple children folders.
This command more or less does what I want:
find . -name \*.E01 | xargs -n 1 ewfverify > ewfverify.out
I'd say "less" because you over-write the file on each iteration. Perhaps you mean ">>" instead of ">" You might also look at "-print0" and "-0"
I think just using find -exec will be better.
I disagree. I'm a firm believer in the old UNIX axiom "Each thing does one thing and only one thing and does it well" Rather than get myself confused I might even write it in this form find .... | while read filename do cd ........ ewverify $filename ...... done That way I'm sure about a lot of things, such as the directory the commands are being run in. -- ... it is easy to be blinded to the essential uselessness of them by the sense of achievement you get from getting them to work at all. In other words... their fundamental design flaws are completely hidden by their superficial design flaws. -- The Hitchhiker's Guide to the Galaxy, on the products of the Sirius Cybernetics Corporation. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org