Friday, May 3, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 1948  / 1 Year ago, sun, december 25, 2022, 5:27:30

Using Ubuntu 12.04 I need help on copying files that were returned from a search with grep .



I have many pdf files, so to filter specific named files I am using General grep command as
follows.



raja@badfox:~/Desktop/mtech/M.Tech II Sem-April 2012$ grep "DESIGN OF FAULT TOLERANT SYSTEMS" *.pdf
Binary file NR-DESIGN OF FAULT TOLERANT SYSTEMS.pdf matches
Binary file R09-DESIGN OF FAULT TOLERANT SYSTEMS.pdf matches


How do I automatically copy the files returned from the search to another directory?


More From » command-line

 Answers
3

An easier way to do it would be to just use cp.



cp *"DESIGN OF FAULT TOLERANT SYSTEMS"*.pdf /some/folder/

[#36416] Monday, December 26, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
antorchestr

Total Points: 92
Total Questions: 111
Total Answers: 120

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
;