Your Ad Here

Selasa, 10 Januari 2012

Unix Tip: SEARCH SEVERAL FILES

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3258 - January 10, 2012

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


SEARCH SEVERAL FILES

To search several files for a
string which you know sparsely,
the following searching technique
would be useful:

#grep <first part>.*<second part>.*<... part> <filenames>
or,
#ls|xargs grep <first part>.*<second part>.*<... part>


This will print all the filenames
and lines which consists of
"<first part><0 to any number of
characters><second part><0 to any
number of characters><third part>
......"

For example, you want to search a
data structure among several header
files where it has been declared
not where it is being used.

If the data structure be XYZ, then
search will be:

#grep }.*XYZ <filenames>

because you know it might be how
XYZ has been declared,
struct {
.....
.....
} XYZ
You don't know exactly how many
blank characters are there
unless you count them. But when XYZ
will be used it will be
done as follows(for example):

XYZ *xyz;

and you don't want them to find out
as they will be coming
in several header or C files.


This tip generously supported by: dipakb@cdotd.ernet.in


--------------------------------------------------------------------------
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@ugu.com - Copyright 1994-2001
==========================================================================

Tidak ada komentar:

Posting Komentar

Your Ad Here
Free Automatic Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink