Improve performance of fossil support

Replace over use of grep/cut with sed or awk, globally reduce number of fossil call. This PR is an answer to issue #188.