View Single Post
  #3   (View Single Post)  
Old 28th May 2011
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

While I agree that a solution using find(1) is much more elegant, you can also fall back to simple shell scripting to accomplish the same thing:
Code:
#!/bin/sh
for f in $(ls | grep foo) ; do
    echo "cp $f /dest"
done
  • Place the above code into a text file & execute as an argument to sh(1) or make the file executable through chmod(1).
  • Once satisfied that the output constructs the needed command, remove echo & the double-quotes.
Reply With Quote