AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  exec cp

    Posted Mon December 20, 2010 05:43 AM

    Originally posted by: big


    Hi,

    on AIX 6.L
    I want to copy the result of grep -v to test directory then :

    Code:

    `hostname`@oracle$ls -l | grep -v RINT -exec cp {} test
    grep: can't open -exec
    grep: can't open cp
    grep: can't open {}
    test:°`.
    Can you help me ?

    Thank you.


  • 2.  Re: exec cp

    Posted Mon December 20, 2010 10:59 AM

    Originally posted by: shargus


    I really don't understand what you are trying to do...

    "-exec" is an option for find, not for grep.


  • 3.  Re: exec cp

    Posted Wed December 22, 2010 04:59 PM

    Originally posted by: Runevitki


    If all you are trying to do is take the sysout from grep and "copy" it to a file...

    ls -l | grep -v RINT > test\NameOfFile

    If you want to copy it to a file AND sysout

    ls -l | grep -v RINT | tee test\NameOfFile

    Hopefully this is what you wanted, and there are likely a multitude of ways to do this using other commands.


  • 4.  Re: exec cp

    Posted Thu December 30, 2010 11:34 AM

    Originally posted by: garethr


    You mean something like:

    find . -name '*RINT*' -exec cp {} test \;


  • 5.  Re: exec cp

    Posted Fri February 11, 2011 03:29 PM

    Originally posted by: debbyhuang


    please try:

    for i in `find ....`
    do
    cp $i....
    done