So I have a text file containing strings of numbers with a word at the end:
123456 126 2 12456 1256 4 46 12346 123456 4 56 word
24 245 1234 356 12346 6 3 346 245 5 12346 12356 word
I want to find all lines that have at least 8 strings containing either 1 or 6 or both. So the first line would pass because it has 8 strings (seperated by spaces) that contain either 1 or 6 or both. The second one only has 7 strings that contain either 1 or 6 or both.
I tried the follow regex, but it gives a backtracking limit error: ([0-9]*(1|6)[0-9]* .*){8,}
1112
,116565
,6000066
. please edit to respondsed -n "s/\([^ ]*[1|6][^ ]*\).*/\1/p"
(It's just for one occurence...)[1|6]
matches one of1
,|
, or6
.grep -E
.