I'm having some problems with the {}
operator. In the following examples, I'm trying to find the rows with 1, 2, and 2 or more occurrences of the word mint
, but I get a response only if I search for 1
occurrence of mint
, even though there are more than 1
per row.
The input I am processing is a listing like this obtainded with the ls -l
command:
-rw-r--r-- 1 mint mint 26 Dec 20 21:11 example.txt
-rw-r--r-- 1 mint mint 26 Dec 20 21:11 another.example
-rw-r--r-- 1 mint mint 19 Dec 20 15:11 something.else
-rw-r--r-- 1 mint mint 1 Dec 20 01:23 filemint
-rw-r--r-- 1 mint mint 26 Dec 20 21:11 mint
With ls -l | grep -E 'mint{1}'
I find all the rows above, and I expected to find nothing (should be all the rows with 1 occurrence of mint
).
With ls -l | grep -E 'mint{2}'
I find nothing, and I expected to find the first 3 rows above (should be all the rows with 2 occurrences of mint
).
With ls -l | grep -E 'mint{2,}'
I expected to find all the rows above, and again I found nothing (should be all the rows with at least 2 occurrences of mint
).
Am I missing something on how {}
works?