I have a csv file containing a list of patterns like this
file 1:
aaa;bbb
ccc;ddd
eee;fff
...
file 2:
aaa2222222222222222
3333333333333333333
4444444444444444444
bbb555555555555555
8888888888888888888
ccc5555555555555555
5555555555555555555
0000000000000000000
ddd6666666666666666
How can I use the 2 patterns in each row (e.g. aaa & bbb) from file 1 in a sed -n '/aaa/,/bbb/p' command to match and print lines in between the matching patterns from file 2, save the output and then replace the command with the next pair of patterns to repeat the process?
The output I´m expecting is
333333333333333
444444444444444
saved to a new file as they are the lines between aaa & bbb
Then use a loop to find the next set of lines between ccc & ddd, etc.
aaa, etc. anywhere on the line or only at the start of the line? Do you want to do a regexp or string comparison? Can you have overlapping ranges in files1? How about nested ranges? How about duplicate ranges or duplicate start or end values?