03-06-2007
If you want to get the details of the file containing string 'string', you this
grep -ir 'string' /dir/from/where/you/want/to/search
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am new to Unix world. Is there any command which can directly return the second occurance of a particular string in a file? Basically, I want to read the contents of the file from the second occurance of a particualr string. Can be implemented using a loop, but am just wondering if there... (5 Replies)
Discussion started by: saurabhsinha23
5 Replies
2. Shell Programming and Scripting
Hi
I have requirement to search string starting with specific characters and print whole matching word in that string.
example
mystr="ATTRIBUTE NAME="Event Name" VALUE="Execute""
I want to search by passing "NAME=" and result should be NAME="Event Name".
i am using below command but... (3 Replies)
Discussion started by: tmalik79
3 Replies
3. Shell Programming and Scripting
Hi Forum,
I am using the below command to find files older than x days in a directory excluding subdirectories. From the previous forums I got to know that prune command helps us not to descend in subdirectories. Though I am using it here, not getting the desired result.
cd $dir... (8 Replies)
Discussion started by: jhilmil
8 Replies
4. UNIX for Dummies Questions & Answers
Hi everyone,
I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file
I know will have to use the read and grep commands, anyone can give me somewhere to start would help
Task: Write a script to display... (1 Reply)
Discussion started by: 12ic11
1 Replies
5. Shell Programming and Scripting
Hi everyone,
I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file
I know will have to use the read and grep commands, anyone can give me somewhere to start would help
Task: Write a script to display which volume pool a given... (1 Reply)
Discussion started by: 12ic11
1 Replies
6. Shell Programming and Scripting
Hi Don, this is not homework question. I work for a Credit card company and my development goal this year is to learn Unix. I would love if others can help me get started, thanks.
Hi everyone
I am new to Unix and need help writing a script that can ask user for an input, then search that input... (2 Replies)
Discussion started by: 12ic11
2 Replies
7. Shell Programming and Scripting
Hello,
one step in a shell script i am writing, involves Grep command to search a regular expression in a line an only print the string after the match
an example line is below
/logs/GRAS/LGT/applogs/lgt-2016-08-24/2016-08-24.8.log.zip:2016-08-24 19:12:48,602 ERROR... (9 Replies)
Discussion started by: Ramneekgupta91
9 Replies
8. Shell Programming and Scripting
Hi,
How can I use find command to search string/pattern in a file recursively?
What I tried:
find . -type f -exec cat {} | grep "make" \;
Output:
grep: find: ;: No such file or directory
missing argument to `-exec'
And this:
find . -type f -exec cat {} \; -exec grep "make" {} \;... (12 Replies)
Discussion started by: cola
12 Replies
9. UNIX for Beginners Questions & Answers
Good Evening Folks -
I have a need to search a specific directory and ALL sub-directories for the following string:
Data Load UpdatedIf this string is found, I need to print content from the line directory above it between symbols, as well as the file name where it is found.
Here is a... (1 Reply)
Discussion started by: SIMMS7400
1 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I hope somebody would be able to help me.
I would need to search a string coming from a file, example file.txt:
dog
cat
goat
horse
fish
For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Discussion started by: kokoro
9 Replies
LEARN ABOUT OPENDARWIN
instr
INSTR(3) MBK UTILITY FUNCTIONS INSTR(3)
NAME
instr - find an occurence of a string in a string, starting at a specified character.
ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in
Paris, France.
Web : http://asim.lip6.fr/recherche/alliance/
E-mail : alliance-users@asim.lip6.fr
SYNOPSYS
#include "mut.h"
char *instr(s, find, from)
char *s, *find, from;
PARAMETERS
s Pointer to the string to be searched for the pattern
find Pointer to the string to be found, the pattern
from Character to be searched backwards before searching for the pattern
DESCRIPTION
instr searches the first occurence of the string find in the string s, starting its search at the last occurence of the from character in
the string s.
If either s or find is NULL, the function returns NULL. If from is (char)0, the pattern is searched from the begining of s.
This quite exotic behaviour is useful to search the occurence of a name in a string resulting from a flatten, when only a terminal object
name is to be taken into account.
RETURN VALUES
instr return NULL either if the pattern find is not present in the searched string s, or if one at least of these two string are NULL. If
the pattern is found, a value different from NULL is returned.
EXAMPLE
#include "mut.h"
/* check for the pattern 'ck' anywhere in the string */
#define contains_ck(name)instr(name, "ck", ' ')
/* check for the pattern 'ck' in the signal name, not instance ones */
#define isclock(ptsig) instr(getsigname(ptsig), "ck", SEPAR)
SEE ALSO
mbk(1), isvdd(3), isvss(3).
BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory.
We need your feedback to improve documentation and tools.
ASIM
/LIP6 October 1, 1997 INSTR(3)