==== dummy ==== * [[Remove lines with duplicate letters]] * [[grep on find results]] ==== wordscapes ==== tags | word scape, wordscape % grep -i "^[slev][slev][slev][slev]s$" /usr/share/dict/american-english elves sells Remove lines with duplicate letters % grep -Ei "^[hikers]{5}$" /usr/share/dict/american-english | grep -Eiv "(.).*\1" ... shire shirk skier compare this with % grep -Ei "^[hikers]{5}$" /usr/share/dict/american-english ... shire shirk shirr sires sises skier skies which also shows words where some letters are repeated twice. ==== repeat previous character N times ==== Use (character){N} and call grep with -E % grep -Ei "^[enrich]i([enrich]){2}e$" /usr/share/dict/american-english Circe niche niece is equivalent to % grep -i "^[enrich]i[enrich][enrich]e$" /usr/share/dict/american-english Circe niche niece Another example: % grep -Ei "^([dunes]){2}u([dunes]){2}d$" /usr/share/dict/american-english unused ==== print lines with less than a certain number of characters ==== To print lines that contain less than N characters grep -Ev ".{N}" data.txt For example: To print lines that contain less then 6 characters grep -Ev ".{6}" data.txt You can also do grep -v "......" data.txt where the . is repeated N times. This is easier to type for small N. Sample run: $ cat data.txt a ab abc abcd abcde abcdef abcdefg $ grep -v "......" data.txt a ab abc abcd abcde $ grep -Ev ".{6}" data.txt a ab abc abcd abcde