simple regex (not for me)

Hello everybody,
I need to detect if a line contain a word, this word is at the end of the line and it could have or not a slash at the end of the line, there is an example:
Code:
directory Exemple/Test/
directory Exemple/Test

if I want to detect the both lines because there is Test, I use grep:

grep '.*/Test/?$'

but it doesn't work.

Can you help me?

(Don't worry if my english is bad, I don't control very well Shakespeare's language)
 
Use [cmd=""]egrep[/cmd] or [cmd=""]grep -E[/cmd] (which is the same).
Code:
printf "directory Example/Test/\ndirectory Example/Test\ndirectory Example/Test/Not" | egrep '/Test/?$'
directory Example/Test/
directory Example/Test
 
Back
Top