if i have a file that contains common directory
-bash-3.2$ cat test
/opt
/opt/mdm
/opt/test
-bash-3.2$
how can i grep "/opt" so that the result should only show "/opt"
if i have a file that contains common directory
-bash-3.2$ cat test
/opt
/opt/mdm
/opt/test
-bash-3.2$
how can i grep "/opt" so that the result should only show "/opt"
grep "\/opt$" filename
wow thanks!
cat test | grep -x 'opt'
cat test | grep -w "\/opt"
i think it will also do
grep -w \/opt$ filename
Sorry dude above one is not working
-bash-3.00$ grep -w \/opt tr.txt
output :/opt
/opt/share
/opt/vind
what do u say ?