Note that there are some explanatory texts on larger screens.

plurals
  1. POSearching LDAP Query in bash using regex
    primarykey
    data
    text
    <p>I have a LDAP query that I'm inputting to a script via stdin. I want to search for specific values, and possibly more than one, and then send the found value via stdout. </p> <p>My LDAP query looks as such: </p> <pre><code>discover-repository-location=null, File Name=null, date-detected=Tue Jun11 12:44:14 UTC 2013, endpoint-machine-name=null, incident-id=545527, sender-ip=12.1.141.87, sender-email=WinNT://tmpdm/tmpcmp, Assigned To=null, sender-port=-null, endpoint-domain-name=null, Business Unit=null, endpoint-dos-volume-name=null, file-access-date=null, date-sent=Tue Jun 11 12:44:14 UTC 2013, endpoint-file-name=null, file-modified-by=null, Country=null, Manager Email=null, plugin-chain-id=1, discover-server=null, data-owner-name=null, Dismissal Reason=null, Last Name=null, First Name=null, Phone=null, subject=HTTP incident, Sender Email=null, UserID=null, endpoint-user-name=null, endpoint-volume-name=null, discover-name=null, discover-content-root-path=null, data-owner-email=null, file-create-date=null, endpoint-application-name=null, Employee Code=null, Region=null, Manager First Name=null, path=null, endpoint-application-path=null, Manager Last Name=null, Department=null, discover-location=null, protocol=HTTP, Resolution=null, file-owner=null, Postal Code=null, endpoint-file-path=null, Title=null, discover-extraction-date=null, Script-attribute=null, Manager Phone=null, file-created-by=null, file-owner-domain=nul </code></pre> <p>And say I want to pull out the <strong>protocol</strong> or the <strong>sender-email</strong> attributes from this query, which reads in as a single line. I can simply read it in by:</p> <pre><code>while read stdin line; do echo $line done </code></pre> <p>Now I can check that these attributes exist, however I am having trouble grabbing the value that is in the key-value pair. I am trying to do so with regular expressions in bash. I'd like to grab the full value using '=' and ',' as the delimiters, and then possibly use regular expression to validate that I've grabbed a correct value from my attribute (as a safety check, and for logging purposes).</p> <p>Any input would be useful and greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload