Frage

I have followed many links and reference documentation but still facing errors. I want to list all the words start or ending with 'sx'. I already found a solution which works fine:

awk '/^sx|sx$/' usr/dict/words

However I tried to use grep or egrep and neither worked. And then I made it simpler. Any word which contains 'ax' or 'sx', and again it did not work!

grep 'ax|sx' words
grep -E '^ax\|sx$' words
egrep '^ax\|sx$' words

Error:

grep: illegal option -- E
Usage: grep -hblcnsviw pattern file . . .

Any suggestion appreciated.

enter image description here

War es hilfreich?

Lösung

This should work for you:

egrep '(^ax|sx$)' usr/dict/words

NOTE:
I couldn't find any words ending in sx on the dictionary I've used.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top