Friday, 15 January 2010

linux - Grep filtering of the dictionary -



linux - Grep filtering of the dictionary -

i'm having hard time getting grasp of using grep class in hoping help guide me in assignment. assignment follows.

using grep print 5 letter lower case words linux dictionary have single letter duplicated 1 time (aabbe or ababe not valid because both , b in word twice). next print duplicated letter followed purchase non-duplicated letters in alphabetically ascending order.

the teacher noted need utilize several (6) grep statements (piping results next grep) , sed statement (string editor) reformat final set of words, pipe them read loop tear apart 3 non-dup letters , sort them.

sample output: aback bck abaft bft abase bes abash bhs abask bks abate bet

i haven't figured out how more printing 5 character words,

grep "^.....$" /usr/share/dict/words |

didn't check thoroughly, might work

tr '[:upper:]' '[:lower:]' | egrep -x '[a-z]{5}' | sed -r 's/^(.*)(.)(.*)\2(.*)$/\2 \1\3\4/' | grep " " | egrep -v "(.).*\1"

but way because might see here.

linux bash sed grep

No comments:

Post a Comment