Artificial intelligent assistant

How to grep a single line with a pattern containing single quotes, pipe and a pattern with a / after? i've a file as below 'ABC'|filler|'Y'|'john/1'|'text' 'ABC'|filler|'Y'|'john1'|'te/xt' 'ABC'|filler|'N'|'mary/2'|'text' 'DEF'|filler|'N'|'jane/3'|'text' i want my grep to return the following results 'ABC'|filler|'Y'|john/1|'text' 'ABC'|filler|'N'|mary/2|'text' whereby the conditions are 1. containing the word ABC 2. matching the pattern of either 'Y' or 'N' and after the pipe should contain a forward slash i'm currently stuck at **wordY= "'Y'|"** **wordN= "'N'|"** **grep ABC test.txt | grep "$wordY|$wordN"** which are returning 'ABC'|filler|'Y'|'john/1'|'text' 'ABC'|filler|'Y'|'john1'|'te/xt' //i do not want this 'ABC'|filler|'N'|'mary/2'|'text' how do i add on to the command to return results values with forward slash in the 4th column as well?

Using `grep`


$ grep -E "^'ABC'\|[^|]*\|'(Y|N)'\|'[[:alpha:]]+/" input_file
'ABC'|filler|'Y'|'john/1'|'text'
'ABC'|filler|'N'|'mary/2'|'text'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 90099b9e84e5945cd57ab07a308c8f8d