• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Search in UNIX; a simple question

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.
1 Solution
I don't remember if it's good but you can try:
cd /
find . -print | grep '/u1/xxx/yyyy'
iqbaljAuthor Commented:
Edited text of question
iqbaljAuthor Commented:
Edited text of question
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

find . -type f \! -name '*.log' \! -name '*.trc'
Use the following find command.  It will work.

First cd /

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

iqbaljAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now