Finding Strings between 2 characters in a file

One last question pls..i checked the regular expression link...but it does not say how to negate the operator =~, ie instead of looking for match if i want check if pattern is not matching "$F" =~ \.c$ and if i want to check if it does not contain 'C' then error..sorry for so many questions on this

For checking if pattern is not matching use logical not !

[[ ! "$F" =~ \.c$ ]] && # action

Or put action in else part:

[[ "$F" =~ \.c$ ]] && # matched action || # unmatched action
1 Like

Thank You !!!!