Say I have a directory that contains other directories and files. I want to search for a string in each file and copy only the matching lines to another location while preserving directory structure.
For example, say I have this structure
dir subdir1 file1.txt subdir2 file2.txt
Now I want to get only matching lines from the files that contain 'de', so the outcome I want should look like this:
dir subdir1 file1.txt subdir2