For example, if there are files and directories:
/tmp/temp_dir/subdir_001/file_001.txt
/tmp/temp_dir/subdir_001/file_002.txt
/tmp/temp_dir/subdir_002/file_003.txt
/tmp/temp_dir/subdir_003/file_004.txt
And those have various contents with specific lines that can be found by regex. For example, here is the content of the file file_001.txt
:
abc cba
little boy writes -54321_12345 and goes to street 987
bca acb
little boy writes -12345_54321 and jumps to street 789
cab bac
What I'm interested is those lines that are started with little boy writes
.
I'm using this regex pattern to find important data that I would like to save as output:
little boy writes (\-\d+\_\d+).*street (\d+)
How can I search it recursively and output only matched strings? So in output file I would only have this:
54321_12345 987
12345_54321 789