Most people are familiar with using find to run the same command on a number of files, e.g.:
find -type f | xargs command
or
find -type f -exec command {} \;
My question is whether it's possible to run multiple commands from find:
find [path] [expression] -exec command1 {} -exec command2 {} \;
so that the output would look like
command1: file1
command2: file1
command1: file2
command2: file2
command1: file3
command2: file3
command1: file4
command2: file4
Obviously I can write a simple shell script wrapper for this, but is it possible to do it all from the command line (perhaps using awk
, tee
etc.)?
You could do something simple like this.
Or