I am trying to use grep to capture data below:
"\\.xy$" "\\.ab$" "\\.ef\\.hi$"
I have
grep -Eo "((\\\\\.[a-zA-Z]+)){1,2}\\$" file
two problems:
Precede the dollar with a single backslash:
% grep -Eo '"(\\\\\.[[:alpha:]]+){1,2}\$"' input
"\\.xy$"
"\\.ab$"
"\\.ef\\.hi$"
Or put the special characters into square brackets, which I find more readable:
% grep -Eo '"([\]{2}[.][[:alpha:]]+)+"' input
"\\.xy$"
"\\.ab$"
"\\.ef\\.hi$"