>>>>> "D" == D Venkatasubramanian <D.Venkatasubramanian> writes:

    D> Hi, I have a directory structure

    D> ----obj ----c_test ----cpp_test ----result

    D> There are some exe files in obj by the name ctest001.out,
    D> ctest002.out, ...  ,ctest044.out and some more files
    D> cpptest001.out, cpptest002.out, ... , cpptest083.out.

    D> That makes around 127 files.  I want to run a tool on these
    D> files with some options. The tool outputs some lines, I want to
    D> capture those outputs and redirect them to a file for each of
    D> the objects, with the name ctest001.dmp, etc., i-e- , remove
    D> the .out extension and append a .dmp extension. Finally all
    D> these 127 dmp files are to be placed in the result dir. I would
    D> like to write a shell script for the same. How do I do this
    D> with a for loop like structure and also manage to remove the
    D> extension and append a new one?

for i in `find . -name "*.out"` ; do cp $i result/`basename $i .out`.dmp ; done

-- Raju
-- 
Raju Mathur          [EMAIL PROTECTED]           http://kandalaya.org/
                     It is the mind that moves

          ================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
          =================================================

Reply via email to