Friday, July 13, 2012

Search MS word files in a directory for specific content in Linux



We cannot use 'grep' command on MS word (.doc) file because the text, in a .doc file, is broken and interspersed with field codes and formatting information. If you search for something short then you have better chance of finding a match but search results won't be much helpful.







I think your best option would be do the search by doing 'Ctrl + F' on a folder to search specific string.







Unfortunately, for this search to work, you will have to copy the files to your local machine because windows uses indexing for string searches and indexing is not available on mapped network drives.

Case Insensitive search using grep
> grep -i "search_string" FileName.txt