Sponsored Content
Full Discussion: exact string match in a word
Top Forums UNIX for Dummies Questions & Answers exact string match in a word Post 302267885 by dr_sabz on Sunday 14th of December 2008 11:48:20 AM
Old 12-14-2008
Thank you but this is already a tried method and does not work if you want to search for a string in a continuous word. eg.

filein:
hellohellolayla

grep -w "hello" filein
Returns a blank, because I am searching for a substring and not a whole string as the option -w forces.

Thanks anyway...any other help from anyone...I am close Smilie but need a little more advice
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I search a File for a string exact match

Hi, Can you help please. I have the following comand: if ]; then l_valid_string="Y" fi The problem I am trying to solve is that my l_string = ABC and my file contains ABC ABC_EFG I only want back the value ABC exact match. (3 Replies)
Discussion started by: CAGIRL
3 Replies

2. Shell Programming and Scripting

Searching for exact match in a string ??

Hi I have a string of the form XY_X1998.10.500. I want to check in a script that the middle part is always 10. How to achieve this? e.g the input can be XY_X1998.20.500 OR XY_X1998.50.500 OR XY_X1998.10.500. I have to print Yes everytime the middle value is 10 and NO when the middle... (2 Replies)
Discussion started by: skyineyes
2 Replies

3. Shell Programming and Scripting

Exact Word Match

I'm trying to find a exact word match but couldn't do it. ABC ABC_NE Searching for ABC_NE tried grep -w </ABC_NE/> grep "^ABC_NE$" but didn't worked , any awk variants would also help. ---------- Post updated at 08:40 AM ---------- Previous update was at 06:48 AM ---------- I... (2 Replies)
Discussion started by: dinjo_jo
2 Replies

4. Shell Programming and Scripting

sed to match only exact string only in all occurences

Dear Friends, Anybody knows how to match exact lines only in multilinear. Input file: apple orange orange apple apple orange Desired output: fruit orange apple fruit i used the command (1 Reply)
Discussion started by: vasanth.vadalur
1 Replies

5. Shell Programming and Scripting

How to match a exact word in a variable ????

Hi All, Str="online maintenance" if then perform some action I know the above comparison is wrong ..... Actually I am very new to this solaris.. I want to check for online in a variable and perform some action based on that How can I do it? (6 Replies)
Discussion started by: vijaysachin
6 Replies

6. Shell Programming and Scripting

exact string match ; search and print match

I am trying to match a pattern exactly in a shell script. I have tried two methods awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies

7. Shell Programming and Scripting

Finding exact match string

Hi All, I'm writing unix script, it should find exact matching in search string. Looks simple but when i started i'm stuck to find the exact match character string. The unix script reads the records from DB Table. The table will have values something likes these Feed : A Feed File name :... (3 Replies)
Discussion started by: luckybalaji
3 Replies

8. UNIX for Dummies Questions & Answers

How to grep the exact string / word ?

Hi All, I have a text / log file which contains strings like meta777, 77, meta, 777. Now I want to write a script which can detect a string 'meta#777' in a text file & number of occurence of 'meta', number of #, number 7, 77, 777. I'm using grep -e '77' filename but no luck. It is returning... (5 Replies)
Discussion started by: adc22
5 Replies

9. Shell Programming and Scripting

Get the exact match of the string!

Hi All, I am breaking my head in trying to get a command that will exactly match my given string. I have searched net and found few of the options - grep -F $string file grep -x $string file grep "^${string}$" file awk '/"${string}"/ {print $0}' file strangely nothing seems to... (3 Replies)
Discussion started by: dips_ag
3 Replies

10. Shell Programming and Scripting

Help match the exact string

I just want to match "binutils1_test" only, and print the match line only lyang001@lyang001-OptiPlex-9010:/tmp$ cat file zbinutils1_test bbinutils1_test binutils1_test w-binutils1_test lyang001@lyang001-OptiPlex-9010:/tmp$ cat file |grep -w 'binutils1_test' ... (7 Replies)
Discussion started by: yanglei_fage
7 Replies
LDAPFILTER.CONF(5)						File Formats Manual						LDAPFILTER.CONF(5)

NAME
ldapfilter.conf - configuration file for LDAP get filter routines SYNOPSIS
/etc/openldap/ldapfilter.conf DESCRIPTION
The file /etc/openldap/ldapfilter.conf contains information used by the LDAP get filter routines (see ldap-getfilter(3)). Blank lines and lines that have a first character of `#' are treated as comments and ignored. The configuration information consists of lines that contain one, two, three, four, or five tokens. Tokens are separated by white space, and double quotes `"' can be used to include white space inside a token. The file consists of a sequence of one or more filter sets. A filter set begins with a line containing a single token called a tag. The tag is used in the ldap_getfirstfilter(3) call to select the filter set. The filter set consists of a sequence of one or more filter lists. The first line in a filter list must contain four or five tokens: the value pattern, the delimiter list, a filter template, a match description, and an optional search scope. The value pattern is a regular expression that is matched against the value passed to the ldap_getfirstfilter(3) call to select the filter list. The delimiter list is a list of characters (in the form of a single string) that are used to break the value into distinct words. The filter template is used to construct an LDAP filter (it is described further below) The match description is returned to the called along with a filter as a piece of text that can be used to describe the sort of LDAP search that took place. It should correctly compete both of the following phrases: "One match description match was found for..." and "Three match description matches were found for...." The search scope is optional, and should be one of "base", "onelevel", or "subtree". If search scope is not provided, the default is "sub- tree". The remaining lines of the filter list should contain two or three tokens, a filter template, a match description and an optional search scope (as described above). The filter template is similar in concept to a printf(3) style format string. Everything is taken literally except for the character sequences: %v %v$ %vN %vM-N %vN- A plain %v means to substitute the entire value string in place of the %v. %v$ means substitute the last word in this spot. A %vN, where N is a single digit 1-9, means substitute word N in this spot. Words are number from left to right within the value starting at 1. A %vM- N, where M and N are both single digits 1-9, means substitute the indicated sequence of words. A %vN-, where N is again a single digit 1-9, means substitute word N through the last word in value. EXAMPLE
The following ldap filter configuration file contains two filter sets (finger and go500gw onelevel), each of which contains four filter lists. # ldap filter file # finger "=" " " "%v" "arbitrary filter" "[0-9][0-9-]*" " " "(telephoneNumber=*%v)" "phone number" "@" " " "(mail=%v)" "email address" "^.[. _].*" ". _" "(cn=%v1* %v2-)" "first initial" ".*[. _].$" ". _" "(cn=%v1-*)" "last initial" "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" "(|(sn~=%v1-)(cn~=%v1-))" "approximate" ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" "(|(cn~=%v1)(sn~=%v1))" "approximate" "go500gw onelevel" "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact" "onelevel" "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate" "onelevel" " " " " "(|(o=%v)(l=%v)(co=%v)" "exact" "onelevel" "(|(o~=%v)(l~=%v)(co~=%v)" "approximate" "onelevel" "." " " "(associatedDomain=%v)" "exact" "onelevel" ".*" " " "(|(o=%v)(l=%v)(co=%v)" "exact" "onelevel" "(|(o~=%v)(l~=%v)(co~=%v)" "approximate" "onelevel" The call ldap_getfirstfilter( lfdp, "finger", "m.smith" ); will return an LDAPFiltInfo structure with the lfi_filter member containing the string (cn=m* smith) with the lfi_desc member containing the string first initial, and lfi_scope containing the value LDAP_SCOPE_SUBTREE. The call ldap_getfirstfilter( lfdp, "go500gw onelevel", "umich" ); will return an LDAPFiltInfo structure with the lfi_filter member con- taining the string (|(o=umich)(l=umich)(co=umich) with the lfi_desc member containing the string exact, and lfi_scope containing the value LDAP_SCOPE_ONELEVEL. FILES
/etc/openldap/ldapfilter.conf SEE ALSO
ldap(3), ldap_getfilter(3) ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release. OpenLDAP 2.0.27-Release 20 August 2000 LDAPFILTER.CONF(5)
All times are GMT -4. The time now is 01:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy