Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
it means, that binary files are not grepped and don't flood your output with matching messages. Sometimes you want to do a grep pattern * to search for a pattern in a directory containing text and binary files. If you are not interested in matching results from binary files, the -I option helps you to ignore such files.
You can try this in /usr/bin, which contains a mix of shell scripts and binaries. Do a grep print * with and without this option. You'll see the difference.
Last edited by jan61; 09-16-2008 at 04:11 PM.
Reason: sorry, I meant grep, not sed
This is the part of the man page that tells the story:
If the first few bytes of a file indicate that the file contains
binary data, assume that the file is of type TYPE. By default,
TYPE is binary, and grep normally outputs either a one-line
message saying that a binary file matches, or no message if
there is no match. If TYPE is without-match, grep assumes that
a binary file does not match; this is equivalent to the -I
option. If TYPE is text, grep processes a binary file as if it
were text; this is equivalent to the -a option. Warning: grep
--binary-files=text might output binary garbage, which can have
nasty side effects if the output is a terminal and if the
terminal driver interprets some of it as commands.
Try it on some binary files...First do "cat filename|hexdump -C|more" to see what text strings are there, and then run grep with the different options.
..If TYPE is without-match, grep assumes that a binary file does not match; this is equivalent to the -I option....
All files, which are assumed to be binary by grep, do not output a message about matches. The effect is, that you could grep a number of files without having to take care about unwanted "Binary file /usr/bin/a2p matches" messages.
try it! At my experience it will not work - the options are mutually exclusive. You say "I want binary files to be scanned" and next "I don't want to see binary file's output". The -a option handles binaries like text files (search for a newline or so) and would produce an output you normally do not want to see.
Find out what you get when using the different options. You will not nearly understand what all the options do, if you don't try it on a "real world" system.