M
M
mte2015-12-28 13:53:21
bash
mte, 2015-12-28 13:53:21

How to move files from a folder containing a certain string to another folder?

Help:
there are many (several hundred thousand) files in the folder and in subfolders, you need to find those files that contain a line like XXX=QWERTY and move them to another folder!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2015-12-28
@mte

cd source_directory_name ; grep -rlZ 'XXX=QWERTY' . | xargs -0 -I{} mv \{} dir_name

M
mte, 2015-12-28
@mte

thank !

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question