Grep words made up of a single dot
Hi,
grep "\." gives me ... .. . So does grep -w "\." I need only . Thanks in advance |
It would be nicje to see a sample of the file(s) you are trying to grep, moere info please, your grep command os ok it is matching a single . ... .. . ALL contain single dots you need to add some info around the dot to make it more specific hence we need to know what you are using as source data, try '\b\.\b' this is a single dot bounded by normal word boundary's. space tab newline etc
|
Thank you Keith,
This is an extract of my file. It's an index. '\b\.\b' didn't work . 480 . 481 . 482 . 483 . 484 ... 212 |
try '^\. '
^ anchors to the start of the linr then a asingle dot then a space, you may have to use -e before tge regex to grep. or try sed -n '/^\. /pg' /path/to/your/file, whichwill print all lines that start '. ' |
Hi Keith,
'^\. ' worked, I didn't have to use -e.:) Thank you very much! |
All times are GMT -5. The time now is 05:52 AM. |