My input file looks like this:
13154|X,the deer hunter
13154|Y,the good life
1316|,american idol
1316|,bowling
1316|,chuck
etc...
The X, Y, or any other character (besides a comma) after the pipe is a "Device Type". I want to strip out lines that do not have a device type.
I have tried:
grep "\|.," input.txt
but it matches everything. I think I need to escape the pipe, and that the dot should require a single character match before the comma, but what else am I missing?
I have also tried:
grep "\|[A-Z]+," input.txt
and
grep "\|[A-Z]{1}," input.txt
but that matches everything too. I have also tried escaping the comma, but that does not help. This is GNU grep 2.5.1 on Mac OS X Snow Leopard. Any suggestions would be greatly appreciated.