I have a MSSQL database dump I'm trying to grep through. However, grep does not seem to work on it, at all. Here is a snippet of the file.
...
ALTER DATABASE [Documents] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Documents] SET DISABLE_BROKER
GO
ALTER DATABASE [Documents] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
...
However when I do a grep on it I get nada.
$ cat Documents.sql | grep -i 'alter'
$ <nothing>
$ cat Documents.sql | grep -i 'go'
$ <nothing>
For giggles I created another document 'tempfile' with:
$ cat tempfile
alter
Alter
ALTER
$
And ran the same grep on it:
$ cat tempfile | grep -i 'alter'
alter
Alter
ALTER
Thoughts on why grep wouldn't work on certain files? Concerns me that when I have to grep through a bunch of stuff to find a small nugget, it 'may' be missing something. Thoughts?
Ahh. Thank you.
I faced the same issue with database dump. The other solution by setting the encoding using
vi
worked for me.I prefer using
dos2unix
command and it worked as well.