The blog about containerisation, virtual machines and useful shell snippets and findings

copy files having search string to the target folder

let’s say you have true in the hundreds of files and you need to copy only those which contain this string, it is quite easy to do with Linux find utility

grep -l -ri -m1 "Active>true" */*.xml | xargs -I {} cp {} target_folder