User Tools

Site Tools


remove_lines_with_duplicate_letters

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
remove_lines_with_duplicate_letters [2023/08/11 14:46] – [Solution] rajuremove_lines_with_duplicate_letters [2023/08/27 23:48] (current) raju
Line 4: Line 4:
 ==== Issue ==== ==== Issue ====
 <code> <code>
-grep -"^[hikers][hikers][hikers][hikers][hikers]$" /usr/share/dict/american-english+grep -Ei "^[hikers]{5}$" /usr/share/dict/american-english
 </code> </code>
 gives gives
Line 22: Line 22:
  
 <code> <code>
- % grep -"^[hikers][hikers][hikers][hikers][hikers]$" /usr/share/dict/american-english | grep -viE '(.).*\1+% grep -Ei "^[hikers]{5}$" /usr/share/dict/american-english | grep -viE "(.).*\1"
 Sheri Sheri
 Shrek Shrek
Line 34: Line 34:
 skier skier
 </code> </code>
 +
 +==== Ref ====
 +  * https://unix.stackexchange.com/questions/352927/delete-all-lines-that-contain-duplicate-letters -> comment by Stéphane Chazelas
 +    * I got the idea from here.
 +  * (Mastering Regular Expressions, Jeffrey E.F. Friedl, 2006) book -> Chapter 1 "Introduction to Regular Expressions" -> section "Parentheses and Backreferences" -> pages 20 through 22 go over this concept.
 +
  
remove_lines_with_duplicate_letters.1691765175.txt.gz · Last modified: 2023/08/11 14:46 by raju