What to do if you grep a text file and it becomes Binary file (standard input) matches

--Environment - Windows10 Pro 64bit - grep (GNU grep) 3.1

Event: When I grep a text file, I was told Binary file (standard input) matches

$ grep hoge text_file.txt
Binary file (standard input) matches

Cause: I saw grep in the first few bytes and thought it was a binary file

[The cause and solution that "Binary file (standard input) matched" is displayed in Linux grep search --r_nobu homepage](https://nobuneko.com/blog/archives/2013/04/linux_grep_binary_files_text. html)

Workaround: Add the -a option to specify that the file is a text file.

$ grep -a hoge text_file.txt
hoge
fugahoge

Recommended Posts

What to do if you grep a text file and it becomes Binary file (standard input) matches
What to do if you cat or tail a binary file and the terminal is garbled
What to do if you get a minus zero in Python
What to do if you get a UnicodeDecodeError with pip install
What to do if you get lost in file reference with FileNotFoundError
What to do if you get a TypeError with numpy min, max
What to do if you can't pipenv shell
What to do if you get a "No versions found" error in pipenv
What to do if a Unicode Encode Error occurs in Sublime Text Python
Is Parallel Programming Hard, And, If So, What Can You Do About It?
If you define a method in a Ruby class and define a method in it, it becomes a method of the original class.
What to do if you can't pip install mysqlclient
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
Convert a text file with hexadecimal values to a binary file
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if pvcreate produces a lot of WARNING and cannot be created
What to do when gdal_merge creates a huge file
Links to do what you want with Sublime Text
[Python] Change standard input from keyboard to text file
What to do if you get a Call with too many input arguments error at DoAndReturn in a golang test
What to do if a UnicodeDecodeError occurs in pip
How to install and use pyenv, what to do if you can't switch python versions
What is pip and how do you use it?
Output a binary dump in binary and revert to a binary file
What to do if you run python in IntelliJ and end with an error
What to do if you install openCV3 and make a symbolic link, but when you do "import cv2", "No module named'cv2'" appears
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you are addicted to Windows character code
What to do if pip gives a DistributionError in Homebrew
What to do if you get "coverage unknown" in Coveralls
What to do if you can't sort files with subscripts
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if you can't log in as root
What to do if you can't use WiFi on Linux
What to do if you lose your EC2 key pair
What to do if you get angry with'vertices' must be a 2D list ... in matplotlib arrow
[Django] What to do if the model you want to create has a large number of fields
What to do if you get a must override `get_config` error when trying to model.save in Keras
What to do if you can't install pyaudio with pip #Python
What to do if python says "fatal error:'stdio.h' file not found"
What to do if you can't build your project with Maven
What to do if you can't use the trash in Lubuntu 18.04.
What to do if grep: empty (sub) expression appears on Mac grep
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
Write standard output to a file
What to do if you should have set an ssh key but are prompted for a password
What to do if you get a Permission denied (public key) error when trying to pull on Github
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
What to do if you get the error Input contains NaN, infinity or a value too large for dtype ('float64'). In machine learning
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
What to do if you can't find well with grep's -f option
What to do if there is a decimal in python json .dumps
What to do if you can't find PDO in Laravel or CakePHP
What to do if you couldn't send an email to Yahoo with Python.
What to do if you can't use scikit grid search in Python
What to do if ipython and python start up with different versions
What to do if your disk runs out due to MySQL binary logs
What to do if you forget your login password on Manjaro Linux
What to do if you get angry in TensorFlow v2 without attribute'app'