read file based on key-value format