Artificial intelligent assistant

String processing: remove a prefix and capture all characters before a double-quote I have this data photo for Kurtis Hardy" data- photo for Paul Hoven" data-sr I would like filter this to only get the name in the middle. I used this command to get those line cat File| grep -E -o 'photo for.{0,20}'

No need for cat here. Leave the cat alone.

I'm assuming every name starts right after the "photo for " and ends with the first " as in your example. Let me know if that is not the case. Otherwise we will need to think more about what counts as a "name".


grep -E 'photo for [^"]{0,20}"' File | sed 's/photo for \([^"]\{0,20\}\)".*/\1/'


Or even simpler:


sed -n 's/photo for \([^"]\{0,20\}\)".*/\1/p' File

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy c6aebab7a0f747b180d483f26d967422