I'm searching for a regex code which lists all the lines that contain an a OR an i. I tryed this:
grep -E '[(a|i)]{1}' testFile.txt
but this gives me the words containing a or i and words that contain a en i. What's wrong?
You can achieve that with:
grep -E "^[^ai]*(a|i){1}[^ai]*$" testFile.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With