The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find explantion needed shary Shell Programming and Scripting 3 08-05-2007 11:27 AM
FIND and REMOVE HELP NEEDED!!! scooter17 UNIX for Dummies Questions & Answers 3 09-19-2006 02:42 AM
Find and Remove help needed!!!! scooter17 UNIX for Dummies Questions & Answers 1 09-15-2006 02:26 AM
Find and Replace code help needed E Orgill UNIX for Dummies Questions & Answers 2 08-24-2005 03:05 AM
help on find with chmod.. urgent help needed sdlayeeq UNIX for Advanced & Expert Users 4 03-28-2005 11:05 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-12-2008
max29583 max29583 is offline
Registered User
  
 

Join Date: Dec 2006
Location: UK
Posts: 33
Help needed with find command

Hi Guys,

Can someone help with this.

I have to find out a file name which calls the following sql script "abhishek_to_sdw.sql". In other words it contains a pattern like "abhishek_to_sdw.sql".

I have found out using "find" command that the file abhishek_to_sdw.sql is existing on the server.

Please help me in this.

Regards,
Abhi
  #2 (permalink)  
Old 08-12-2008
ynilesh's Avatar
ynilesh ynilesh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 222
Your question is confusing. Can you please clarify ?
  #3 (permalink)  
Old 08-12-2008
max29583 max29583 is offline
Registered User
  
 

Join Date: Dec 2006
Location: UK
Posts: 33
I have a sql script (abhishek_to_sdw.sql) which is called by some unix shell script file. I dont know which shell script calls this sql script and I want to find that shell script.

Please help me how to find a file with a pattern. which in this case is "abhishek_to_sdw.sql".

Regards,
Abhi
  #4 (permalink)  
Old 08-12-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
If your grep understands the -r flag, just use that.

Code:
fgrep -r abishek_to_sdw.sql /
Or with find,

Code:
find / -type f -exec fgrep abishek_to_sdw.sql /dev/null {} \;
Or with xargs,

Code:
find / -type f -print0 | xargs -r0 fgrep abishek_to_sdw.sql
The find -exec is the least efficient, but somewhat more portable than the others, which depend on GNU-like features. (You can avoid that in the xargs command by taking out the zeros.)
  #5 (permalink)  
Old 08-20-2008
ynilesh's Avatar
ynilesh ynilesh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 222
You need to find all files and grep for your pattern " ". Once you get the result print it.
Code:
find . -type f | xargs grep "abishek_to_sdw.sql"
- nilesh
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0