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
text2 which is not what I want. I'm looking only for finding commas inside the square brackets.
$ grep -E '[*,*]' myfile.txt
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,18.104.22.168,txt1,txt11,['22.214.171.124', '126.96.36.199'] 2.com,188.8.131.52,txt2,txt21,['184.108.40.206'] 3.com,220.127.116.11,txt3,txt31,['18.104.22.168', '22.214.171.124', '126.96.36.199']