Computing.Net > Forums > Programming > Shell script to obtain user details

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Shell script to obtain user details

Reply to Message Icon

Name: saurabh123
Date: April 14, 2009 at 19:15:23 Pacific
OS: Solaris 9
Subcategory: Batch
Comment:

Hi,

I want to write a shell script on Solaris 9 box
to scan a log file and obtain the user login
attempt details.
In short can any one help on writing a shell
script by which I could scan through a Log
files and grep for a particular string say
"AuthAttempt" and then obtain the suer details
related to that.
Usually the string looks like following in the
logs :

AuthAccept smps-uat [15/Apr/2009:12:12:20
1000] " CN=n071143,OU=Non User
Accounts,OU=Administration,DC=testcore,DC
=test,DC=dir,DC=telstra,DC=com" "nus740pf-
app get /SiebelC

Where CN=n071143 is the user. How do i
obtain this value of user. The fixed string in the
logs is AuthAttempt but the suer keeps on
changing.

Any help please.



Sponsored Link
Ads by Google

Response Number 1
Name: saurabh123
Date: April 14, 2009 at 19:20:08 Pacific
Reply:

Apologies for the typo its not "suer" its "user" in the above post. Thanks!!


0

Response Number 2
Name: ghostdog
Date: April 15, 2009 at 00:03:41 Pacific
Reply:

use nawk on Solaris

# awk '/AuthAccept/&&/CN=/{sub(/.*CN=/,"");sub(/,.*/,"");print }' file
n071143

Unix Win32 tools | Gawk for Windows


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Dos Batch replace strings Memory growth and crash



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Shell script to obtain user details

shell script to obtain login ip adr www.computing.net/answers/programming/shell-script-to-obtain-login-ip-adr/5661.html

transfering shell script to windows www.computing.net/answers/programming/transfering-shell-script-to-windows/3681.html

need some help with shell scripting www.computing.net/answers/programming/need-some-help-with-shell-scripting/16784.html