I have a String "c:\working\html\index.txt.12-12-2009.bkp" I want to check if the string has more than one "." character. If it does I would like to retrieve only "c:\working\html\index.txt" i.e, discard the second occurrence of "." and the rest of the string, using Sed command.
The closest I could get to is the following Sed command.
$ echo "c:\working\html\index.txt.12-12-2009.bkp" | sed 's/.*[.]//'
result -> bkp
but it seems sed works from right to left of the string and so finds the last occurrence of the "." returning bkp.
I am using Cygwin to run these commands.
Sed version is "GNU sed version 4.1.5"
bash version si "GNU bash, version 3.2.49(22)-release (i686-pc-cygwin)"