Search in UNIX; a simple question

Posted on 1999-01-12
Medium Priority
Last Modified: 2013-12-06
New to UNIX.

I need to search for  this text;
'/u1/xxx/yyyy' in all the scripts residing in the system.

used the following command:

find . -type f -print | xargs grep -l -i '/u1/xxx/yyyy*'

Returned too many files.

is there any way I can exclude the files with extension '.log' and '.trc'
Looking for the command or a easy way to do this. It's AIX 4.2.

Thanks for the help.
Question by:iqbalj
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 2008703
I don't remember if it's good but you can try:
cd /
find . -print | grep '/u1/xxx/yyyy'

Author Comment

ID: 2008704
Edited text of question

Author Comment

ID: 2008705
Edited text of question
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

LVL 84

Expert Comment

ID: 2008706
find . -type f \! -name '*.log' \! -name '*.trc'

Accepted Solution

rajanxyz earned 100 total points
ID: 2008707
Use the following find command.  It will work.

First cd /

find . -type f ! -name "*.log" ! -name "*.trc" -exec grep -i -l "/u1/xxx/yyyy*" \{\} \;


Author Comment

ID: 2008708
It is now listing all the files (even the Jpegs); I added  '-print' ; Now it looks like this

find . -type f ! -name "*.log" ! -name "*.trc"- print  -exec grep -i -l "/u1/app/oracle*" \{\} \;

I also get this error for some files:

grep: 0652-226 Maximum line length of 2048 exceeded

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question