new to linux/Ubuntu/shell scripting . . .

Tobias Heinemann theine at nordita.dk
Mon Dec 5 19:57:08 UTC 2005


 > thanks for the tip Scott!  It worked!  I then added in the sort:
 > grep -w -e '\(.\)\(.\).\2\1' bigTextFile.txt| sort -d -r > 
palindromes.txt
 >
 > It sorted things in the order that I wanted, but its not getting the
 > palindromes.  Its getting the whole text.  The example of the
 > palindrome search I only found in one place.  Does anyone know of a
 > better way?

Try

   grep -o "\([a-z]\)\([a-z]\)\2\1" bigTextFile.txt

I don't know how to handle mixed upper and lower case palindromes like
"Anna" though...


Regards,
Tobi




More information about the ubuntu-users mailing list