I came up with the following command:
grep 'rtl' reg_list.txt | grep -E -o -n "id_\w+" reg_list.txt
The idea is that first grep lines which contains rtl content, then grep only the words which starts with id_ content. These data is in table, the first column contains rtl, the second column contains id_ data.
The problem is that, the result of first grep is not passed to the second one.
The reg_list.txt consists of different types of data, such as lines, tables with column and rows.