regular expression

Could anyone of you please guide me on making correct regular expression to match the exact word or character

I have some numbers like 12345780 extn 1234
1234567 x 43545
13245678 Extn 454857

 if [[ "$NUMBER" = *[x]* ]]; then
                VAR3=`echo "$NUMBER" | nawk -F "[x]*" '{print $1 $2}'`
                echo insideif
                echo $VAR3
 fi

Output is below:
inside if
12345780 etn 1234
insideif
1234567 43545
insideif
13245678 Etn 454857

---------- Post updated at 07:49 AM ---------- Previous update was at 05:27 AM ----------

Could anyone of you have any suggestion to match exact word using regular exp ?

Whats the value stored in variable NUMBER..?

numbers mentioned in the first message of the thread.. like 12345780 extn 1234

Then try to pattern match it with command sed . You cannot pattern match as highlighted above.
Still not very clear with your requirement. Please brief again and post the exact contents of variable NUMBERS.

echo $NUMBERS| sed '/x/!d'
1 Like

Michael, Sorry for not being precise.
I was looking for whole word match using grep. Now i got it.
Below is the syntax i used..

grep "\<[Ee][Xx][tT]\>"

Thanks for all your help!