Please help me to understand the bold segments in the below regex.
Both are of same type whose meaning I am looking for.
find . \( -iregex './[0-9]\{6,10\}.[0-9]/src' \) -type d -maxdepth 2
Output:
./20111210.0/src
In continuation to above:
sed -e 's|./\([0-9]*.[0-9]\{1,3\}\).*|\1|g'
Output:
20111210.0
What I could gather:
In find it looks for directories starting with 0-9 followed by . (dot) & again the same pattern. Has a directory named src inside it.
The { confuses me.
In sed same thing.
---------- Post updated at 01:00 PM ---------- Previous update was at 12:42 PM ----------
Googling hints that it's probably the count.
Am I on right track?
In general this would mean \{m,n\} a minimum of 'm' numbers and maximum of 'n' numbers in length. Its actually the range. So
[0-9]\{6,10\} - this matches numbers of atleast 6 and atmost 10 in length, hence it matched: 20111210. If in case you have a dir which is say 20112 - this would not get displayed as it has totally/length 5 numbers, whereas our condition says to find with minimum of 6 numbers and a max of 10. Similarly in Sed
.[0-9]\{1,3\} after a dot find for number which is of minimum 1 and a max of 3 in length