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
- containing the word ABC
- 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?