Powershell: Parse Log file case sensitive -


i'm new powershell , need on simple script. i've got big log file (100 m) want parse , return errors , warning messages.
here format of log file:

2013-04-18t10:38:04,110 info [00002865] 30:toto.toto - warning: la variable sousdomn existe déjà pour le fichier work.rgpdroits.

the aim check bold value (which warn ; error ; info) , return lines bold value "warn" or "error"

here script tested on warn value:

$logfile = "c:\log\logfile.log"  cat $logfile | select-string -pattern warn -casesensitive|   select -expand line |    foreach {             write-output $_.             } 

unfortunately, returns "info" messages when contain string warning:

2013-04-18t10:38:04,141 info [00002865] 30:toto.toto - warning: référence symbolique apparente nbpera non traitée.

i think, need use -clike option?

replace pattern with:

select-string -pattern "\swarn\s" 

\s space. can use regular expression in pattern string


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -