![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ksh functions | scriptingmani | Shell Programming and Scripting | 3 | 07-06-2007 04:15 AM |
| finding duplicate files by size and finding pattern matching and its count | jerome Sukumar | Shell Programming and Scripting | 2 | 12-01-2006 01:20 AM |
| functions in | Raom | Shell Programming and Scripting | 6 | 07-21-2006 12:06 AM |
| Regarding functions | sendhilmani | Shell Programming and Scripting | 2 | 03-24-2006 01:40 AM |
| FTP functions | hzambra | High Level Programming | 3 | 05-03-2002 10:06 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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 08:37 AM. |
|
#3
|
|||
|
|||
|
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
|
|||
|
|||
|
Code:
find /cs252/Assingment/commandAsst/project/ -exec grep -l 'sequentialInsert'{} \;
|
|
#5
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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 |
||||
| Google The UNIX and Linux Forums |