Hi I am trying to match lines having following string
BIND dn="uid=
putting something like this is not working :
/\sBIND dn="uid=/
Any suggestion.
Thanks. John
Hi I am trying to match lines having following string
BIND dn="uid=
putting something like this is not working :
/\sBIND dn="uid=/
Any suggestion.
Thanks. John
You are putting it where? What language/tool?
I am using this within a perl script.
Try without "\s":
/BIND dn="uid=/
These are are a couple of examples:
$ cat t
BIND dn="uid=
** Perl example
$ perl -ne '/BIND dn=\"uid=/ && print' t
BIND dn="uid=
** sed example
$ sed -n '/BIND dn\="uid\=/p' t
BIND dn="uid=
Thank you, i have got it.
With awk
echo 'BIND dn="uid=' | awk '/BIND dn="uid=/'
BIND dn="uid=
A comment regarding the \s
:
an anchor like ^BIND
or \bBIND
ensures it won't match WINBIND.
Actually "\s" is not an anchor. It is character class containing space and tab.
And more. It also matches \n
, \f
and \r
. And this is with ASCII. With some locales/Unicode, this shortcut may match many more characters.