Unix Tip #4333- January 21, 2014


SEARCH : Home : Help : Today's Tip

SEARCH SEVERAL FILES


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

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


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

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

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

NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted by various unix admins around the globe. UGU suggest you read and test each tip in a non-volitile environment before placing into production.


LAST 5 TIPS
4332 - ARITHMETIC COMPARISON
4331 - COPY A TREE WITH CPIO
4330 - AUTOMATICALLY SET DISPLAY
4329 - ANOTHER SORT BY FILE SIZE
4328 - FILE CONSISTANCY CHECK


I want to SUBSCRIBE and get a UGU Tip everyday.
I want to UNSUBSCRIBE and NOT get a UGU Tip everyday.

If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
Email Address:

Yes, email me a Hot Unix Tip everday.

Enter Hot Unix Tip (optional):

Yes, I will support this tip

Captcha (not case sensitive):


Please enter the above letters:


HOME | Flavors | Admin | Network | Security | S/W | Help | Events | Vendors | Careers | Internet
About | Add Link | Feedback | Search

Copyright © 1994-2005 Unix Guru Universe