On Mon, Feb 25, 2013 at 2:34 PM, Anton Aylward
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 ';'
Damn, I was a lot closer than I thought. Adding a \ at the end should also work. I also left an arg off basename. This sounds like it should work: find . -name \*.E01 -exec ewfverify -l $(basename -s .E01 '{}').ewfverify.out '{}' \; The actual verifies takes a couple hours each, but if I try the above with a echo I still have one issue left, basename doesn't seem to work:
find . -name \*.E01 -exec echo ewfverify -l $(basename -s.E01 '{}').ewfverify.out '{}' \;
ewfverify -l ./dir1/image1.E01.ewfverify.out ./dir1/image1.E01 ewfverify -l ./dir2/image2.E01.ewfverify.out ./dir2/image2.E01 ewfverify -l ./dir3/image3.E01.ewfverify.out ./dir3/image3.E01 ewfverify -l ./dir4/image4.E01.ewfverify.out ./dir4/image4.E01 ewfverify -l ./dir5/image5.E01.ewfverify.out ./dir5/image5.E01 Basename is working in Per's example, so there is still something wrong above. For now, I will use Per's syntax.
=== 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 ">"
No, the > redirects all of the output into a single concatenated file in this case. Think of it more like ( find . -name \*.E01 | xargs -n 1 ewfverify) > ewfverify.out But the () is implied in the original.
You might also look at "-print0" and "-0"
I'm familiar, but these are files I'm creating, so I won't be having spaces in the middle of the files. Thanks Greg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org