in reply to Search for a string in a file and get the string in the next line

Maybe it’s a travesty to suggest it here, but you can also use a simpler tool like awk in cases like these.   It strictly depends on what you are trying to do, of course.   Just a sometimes-useful tool to consider.