On Tue, Feb 8, 2011 at 8:27 PM, Mark Knecht <markkne...@gmail.com> wrote:

> Hi,
>   Looking for a simple way to do a big copy at the command line. I
> have a bunch of files (maybe 100 right now, but it will grow) that I
> can find with locate and grep:
>
> c2stable ~ # locate Correlation | grep Builder | grep csv
>
> /home/mark/Builder/TF/TF.D-17M-2009_06-2010_11/Correlation/TF.D-17M-2009_06-2010_11-V1.csv
>
> /home/mark/Builder/TF/TF.D-17M-2009_06-2010_11/Correlation/TF.D-17M-2009_06-2010_11-V2.csv
>
> /home/mark/Builder/TF/TF.D-17M-2009_06-2010_11/Correlation/TF.D-17M-2009_06-2010_11-V3.csv
> <SNIP>
>
> /home/mark/Builder/TF/TF.D-31M-2009_06-2010_11/Correlation/TF.D-31M-2009_06-2010_11-V4.csv
>
> /home/mark/Builder/TF/TF.D-31M-2009_06-2010_11/Correlation/TF.D-31M-2009_06-2010_11-V5.csv
> c2stable ~ #
>
>   I need to copy these files to a new directory
> (~mark/CorrelationTests) where I will modify what's in them before
> running correlation tests on the contents.
>
>   How do I feed the output of the command above to cp at the command
> line to get this done?
>
>   I've been playing with things like while & read  but I can't get it
> right.
>
> Thanks,
> Mark
>
>
Another way to do it is with find:
find /home/mark/Builder -type f -iname '*csv' -exec cp {}
~mark/CorrelationTests \;

If catching the *csv is not enough, you can use -ipath instead of -iname and
do something like this:
-ipath '*Builder*csv'
this will match all the path.

Regards,
Kfir

Reply via email to