grep command does not work to find a string inside a file utf-16 format

Solution Verified - Updated -

Issue

  • grep string file_name works but for a specific file dont work. Use the file command to check the format and it is in UTF-16.
file file_name.txt file_name.txt: Unicode text, UTF-16, little-endian
  • While use grep command with other file format (ascii) it works fine.
  • Try to use dos2unix command to change the format but dont work.

Environment

  • Red Hat Enterprise Linux ALL

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.