How can you differentiate between bacterial meningitis and viral meningitis?

Lab work. Blood work and the results of a spinal tap are the definitive way to differentiate between bacterial and viral meningitis.
CSF. By CSF ( cerebrospinal fluid analysis) and cultures you can determine whether patient has bacterial or viral meningitis.