I'm trying mount a regex that get some words on a file where all letters of this word match with a word pattern.
My problem is, the regex can't find accented words, but in my text file there are alot of accented words.
My command line is:
cat input/words.txt | grep '^[éra]\{1,4\}$' > output/words_era.txt
cat input/words.txt | grep '^[carroça]\{1,7\}$' > output/words_carroca.txt
And the content of file is:
carroça
éra
éssa
roça
roco
rato
onça
orça
roca
How can I fix it?
I found a related question here that seems to work.
So if you try something like:
Does that produce what you expect?
Assuming everything is UTF-8, I’d usually just use something like
because then I know what it’s doing.
Try as @dule said, but with
LANG=en_US.iso88591
:If your file is encoded in ISO-8859-1 but your system locale is UTF-8, this will not work.
Either convert the file to UTF-8 or change your system locale to ISO-8859-1.