Wednesday, October 12, 2011

MSSQL error logs in *nix boxes

Today we had to parse one SQL error log file in UNIX box and I saw a kind diff file format -

#grep "Database mirroring is inactive" ERRORLOG.1

And i saw no output. :-(

I thought its dos2unix which can help me. BUT not!!

#file ERRORLOG.4

ERRORLOG.4: Little-endian UTF-16 Unicode English character data, with very long lines, with CRLF line terminators

grep command couldn’t parse the UTF-16 Unicode file. Hence, the file had to be converted to the format which ‘grep’ can parse.

#iconv -f UTF-16 -t UTF-8 ERRORLOG.1 | grep "Database mirroring is inactive"

And cheers! I am done.


No comments:

Post a Comment

AWS re:Invent summary 2017

As you might know, this year’s AWS re:Invent was held @ Las Vegas 11/27 – 12/1.   Below links could be a good start to explore all ...