[olug] Unix Tip: GREP TEXT NOT BINARY

David Walker linux_user at grax.com
Thu Nov 21 21:56:01 UTC 2002


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




More information about the OLUG mailing list