![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to exclude the GREP command from GREP | yamsin789 | UNIX for Advanced & Expert Users | 2 | 10-04-2007 11:59 PM |
| Sun's 'Project Copy Linux' not a Linux copy - Register | iBot | UNIX and Linux RSS News | 0 | 07-29-2007 02:31 AM |
| How to copy ? | nani_ynm | UNIX for Dummies Questions & Answers | 4 | 01-09-2007 01:14 AM |
| Make grep -c display like grep -n? | Jerrad | Shell Programming and Scripting | 2 | 08-24-2006 09:20 PM |
| Copy iso | faron17 | UNIX for Dummies Questions & Answers | 1 | 06-22-2005 05:36 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
copy after grep
i think i got the order wrongly...
cp|grep "get" * test it says argument for cp is 0 i only just want to copy files with the grep input pattern (all are text files definitely) from one directory into another |
| Forum Sponsor | ||
|
|
|
|||
|
You can't pipe cp to grep, that doesn't make sense. A pipeline takes the output from one command and feeds it as input to the next. So the output from cp is what you grep -- that's not what you want.
Where is the destination directory; is that test? You want to copy all files which match the input pattern? Code:
cp `grep -l get *` test Code:
grep -l get * | xargs -i cp {} test
|
|||
| Google UNIX.COM |