I want to search a file to check for patterns like this:
text1,text2,[1.2.3,3.4.5,6.7.8,etc]
exist. The number of commas inside the square brackets is undefined.
I tried the following command but it prints the commas after text1
and text2
which is not what I want. I'm looking only for finding commas inside the square brackets.
$ grep -E '[*,*]' myfile.txt
EDIT #1
Here's some sample input. Note that the commas inside brackets can be more or less than the number in the example (i.e. undefined number so I have to capture them with regex):
1.com,1.2.3.4,txt1,txt11,['1.2.3.4', '5.6.7.8']
2.com,3.4.5.6,txt2,txt21,['5.6.6.6']
3.com,5.5.5.5,txt3,txt31,['1.1.1.1', '2.2.2.2', '3.3.3.3']