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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content