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
ksh functions scriptingmani Shell Programming and Scripting 3 07-06-2007 07:15 AM
finding duplicate files by size and finding pattern matching and its count jerome Sukumar Shell Programming and Scripting 2 12-01-2006 04:20 AM
functions in Raom Shell Programming and Scripting 6 07-21-2006 03:06 AM
Regarding functions sendhilmani Shell Programming and Scripting 2 03-24-2006 04:40 AM
FTP functions hzambra High Level Programming 3 05-03-2002 01:06 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 12-16-2003
adamsy adamsy is offline
Registered User
  
 

Join Date: Dec 2003
Location: Fairfax, VA
Posts: 7
finding functions

I'm working on a project right now and I'm supposed to figure out how to go into a file located in a directory called ~cs252/Assingment/commandAsst/project/ and find all of the function calls to "sequentialInsert" and I tried using

grep "\<sequentialInsert\>"~cs252/Assingment/commandAsst/project/

and that didn't work...so I'm a little stuck right now...Could anyone point me in the right direction? Am I supposed to use some wildcards in place of sequentialInsert?
  #2 (permalink)  
Old 12-16-2003
google's Avatar
google google is offline Forum Advisor  
Moderator
  
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
adamsy Try simply:
find /cs252/Assingment/commandAsst/project/ -exec grep -l 'sequentialInsert'{} \;

Search the directory and list the name of all files matching the string 'sequentialInsert'. Note that you can shorten the path in the find statement. This will cause find to search down the directory tree.
see man find and man grep

Add some grep switches to suit your needs. A few examples:
Ignore case (-i)
Display the line number (-n) of the file where the match occured.
Display the name (-l) of the file where the match occured.

Last edited by google; 12-17-2003 at 11:37 AM..
  #3 (permalink)  
Old 12-18-2003
adamsy adamsy is offline
Registered User
  
 

Join Date: Dec 2003
Location: Fairfax, VA
Posts: 7
Hey, I tried that command that you posted for me and I got two error messages. "find: incomplete statement" and "sequentialInsert;: Command not found". Do you know what I'm doing wrong here? Thanks for the help.
  #4 (permalink)  
Old 12-18-2003
Optimus_P Optimus_P is offline Forum Advisor  
flim flam flamma jamma
  
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
Code:
find /cs252/Assingment/commandAsst/project/ -exec grep -l 'sequentialInsert'{} \;
it all goes on 1 line. i can only assume you put it on 2 lines.
  #5 (permalink)  
Old 12-18-2003
kduffin's Avatar
kduffin kduffin is offline Forum Advisor  
UN1X
  
 

Join Date: Nov 2003
Location: Maryland
Posts: 449
Under Solaris, I had to add a space before the {}. Otherwise it just hung with no path info. Reference: The argument {} is replaced by the current path name.

So,

find /cs252/Assingment/commandAsst/project/ -exec grep -l 'sequentialInsert' {} \;

Cheers,

Keith
  #6 (permalink)  
Old 12-18-2003
adamsy adamsy is offline
Registered User
  
 

Join Date: Dec 2003
Location: Fairfax, VA
Posts: 7
I finally got it to work...It was a problem with the -| in the command. I just took that out and it's working with no errors. Do you have any idea why that could cause an error in the command?
  #7 (permalink)  
Old 12-18-2003
kduffin's Avatar
kduffin kduffin is offline Forum Advisor  
UN1X
  
 

Join Date: Nov 2003
Location: Maryland
Posts: 449
It should be a grep -l (as in the letter in the alphabet). Your text is a grep -| (as in the pipe).

From the grep man page:

-l Print only the names of files with matching lines,
separated by NEWLINE characters. Does not repeat the
names of files when the pattern is found more than
once.

Cheers,

Keith
Closed Thread

Bookmarks

Tags
solaris

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 11:05 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