Sponsored Content
Full Discussion: exact string match in a word
Top Forums UNIX for Dummies Questions & Answers exact string match in a word Post 302267890 by Franklin52 on Sunday 14th of December 2008 12:01:07 PM
Old 12-14-2008
Try this:

Code:
awk -F"hello" '{print NF-1}' file

Use nawk or /usr/xpg4/bin/awk on Solaris if you get errors.

Regards
 

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(4)						   File Formats 						ldapfilter.conf(4)

NAME
ldapfilter.conf - configuration file for LDAP filtering routines SYNOPSIS
/etc/opt/SUNWconn/ldap/current/ldapfilter.conf DESCRIPTION
The ldapfilter.conf file contains information used by the LDAP filtering routines. Blank lines and lines that begin with a hash character (#) are treated as comments and ignored. The configuration information consists of lines that contain one to 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 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 filtertemplate, 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 library call to select the filter list. The delimiter list is a list of the characters (in the form of a single string) that can be used to break the value into distinct words. The filter template is used to construct an LDAP filter (see description below) The match description is returned to the caller 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 subtree. The remaining lines of the filter list should contain two or three tokens, a filter template, a match description and an optional search scope. The filter template is similar in concept to a printf(3C) style format string. Everything is taken literally except for the character sequences: %v Substitute the entire value string in place of the %v. %v$ Substitute the last word in this field. %vN Substitute word N in this field (where N is a single digit 1-9). Words are numbered from left to right within the value starting at 1. %vM-N Substitute the indicated sequence of words where M and N are both single digits 1-9. %vN- Substitute word N through the last word in value where N is again a single digit 1-9. EXAMPLES
Example 1: An LDAP Filter Configuration File The following LDAP filter configuration file contains two filter sets, example1 and example2 onelevel, each of which contains four filter lists. # ldap filter file # example1 "=" " " "%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" "example2 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" ATTRIBUTES
See attributes(5) for a description of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWlldap | +-----------------------------+-----------------------------+ |Stability Level |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ldap_getfilter(3LDAP), ldap_ufn(3LDAP), attributes(5) SunOS 5.10 9 Jul 2003 ldapfilter.conf(4)
All times are GMT -4. The time now is 09:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy