[olug] Unix Tip: GREP TEXT NOT BINARY

Trent Melcher tmelcher at trilogytel.com
Thu Nov 21 22:33:15 UTC 2002


Yes this works on most linux, but remember these are Unix tips, not Linux
tips.  The -I option does not work on most Unix systems unless you have
installed the GNU version of grep.

Then again that is why linux is so great.  Has all the extra options coded
in.

Trent



-----Original Message-----
From: olug-admin at olug.org [mailto:olug-admin at olug.org]On Behalf Of David
Walker
Sent: Thursday, November 21, 2002 3:56 PM
To: olug at olug.org
Subject: Re: [olug] Unix Tip: GREP TEXT NOT BINARY


Or "grep -I <string> . -r" will work

  -I                        equivalent to --binary-files=without-match

On Thursday 21 November 2002 01:02 pm, (Via wrote:
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> 			      UNIX GURU UNIVERSE
> 			         UNIX HOT TIP
>
> 			Unix Tip 2151 - November 21, 2002
>
> 		    http://www.ugu.com/sui/ugu/show?tip.today
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
> GREP TEXT NOT BINARY
>
> In some directories such as /etc you have a mix of file types.
> You may want to grep out a string from one of the files but
> don't want to worry about the binaries, data, etc.  To accomplish
> this, searching only text files do this:
>
> grep <string> `file * | egrep 'script|text' | awk -F: '{print $1}'`
>
>
> This tip generously supported by: Richard.place-eds at eds.com
>
>
>
> --------------------------------------------------------------------------
> To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
> To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe
> To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
>
> ==========================================================================
> DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
> NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
> GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES THAT
> ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
>
> Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
> ==========================================================================
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug

_______________________________________________
OLUG mailing list
OLUG at olug.org
http://lists.olug.org/mailman/listinfo/olug





More information about the OLUG mailing list