How to grep something which begins and end with a character
ABC-0
ABC-1
ABC-10
ABC-20
I wanto to grep -v for ABC-0 and ABC-1
If you are trying to match words use \b
as the word delimiter, like this:
\b[A-Za-z]-\d+\b
from this reference:
\b
- Matches at the position between a word character (anything matched by\w
) and a non-word character (anything matched by[^\w]
or\W
) as well as at the start and/or end of the string if the first and/or last characters in the string are word characters.
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