To make it really simple, I must use a regex to select string in a complex file. I would like to "save" in a file some part of the regex selection. So I use capturing groups and... I don't know how to use th result.
For ex: list.txt :
abc 123 def 456
Here my regex with capture group :
(\d{3}) (\w{3})
The shell command with grep for example (can be something else, I don't care):
egrep '(\d{3}) (\w{3})' list.txt
How do I save or use every \d{3} and \w{3} results? I can't just use
egrep '\d{3}' > digit.txt
Because the capture group is just a small part of a bigger regex
Thanks