Extract out mail ID from from profile list


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Extract out mail ID from from profile list
# 1  
Old 03-11-2010
Extract out mail ID from from profile list

HI,
i HAVE THE PROFILE LIST
Code:
ldapsearch -D cn=root -w root -p 389 mail=dgmp_ndl@bsnl.in
mail=dgmp_ndl@bsnl.in,o=Data Networks,o=Data Networks,o=Data Networks,o=Messagingdb,dc=bsnl,dc=in

I NEED TO SEPERATE ONLY THE MAIL ID
I m USING bash-2.05b$
Code:
ldapsearch -D cn=root -w root -p 389 mail=dgmp_ndl@bsnl.in |grep mail= |cut -d\  -f1
mail=dgmp_ndl@bsnl.in,o=Data

mail=dgmp_ndl@bsnl.in

BUT it is not displaying only the user id but o= field too

Last edited by Franklin52; 03-11-2010 at 04:40 AM.. Reason: Please use code tags!
# 2  
Old 03-11-2010
Code:
ldapsearch -D cn=root -w root -p 389 mail=dgmp_ndl@bsnl.in | sed 's/,.*//'

Or:
Code:
ldapsearch -D cn=root -w root -p 389 mail=dgmp_ndl@bsnl.in | awk -F, '{print $1}'

# 3  
Old 03-11-2010
to seperate out mailid from profile list

hi franklin,
this is not working
displaying the complete profile,
i only need id after " mail="
# 4  
Old 03-11-2010
Quote:
Originally Posted by indoo.pathak
hi franklin,
this is not working
displaying the complete profile,
i only need id after " mail="
Code:
ldapsearch -D cn=root -w root -p 389 mail=dgmp_ndl@bsnl.in | awk -F[,=] '{print $2}'

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract e-mail addresses on a page

Hi I normally ask questions on coding but I think there is a code that can do this. I have regular text throughout my file and I want to extract all e-mail addresses from it (rather than going and searching each one). E-mails all have @ so I assume there is a way. Thanks Phil (6 Replies)
Discussion started by: phil_heath
6 Replies

2. Shell Programming and Scripting

sed to extract a multiline subject from a mail message

I'm trying to extract a subject from a mail message but my subject example has 2 lines. How can I manage to extract it and write a string at the end of it? Consider this example: From: test@domain.com Subject: Re: U =?ISO-8859-1?Q?qu=EA=3F!=3F!=3F!!_wtff_=E7=E3o_=ED=F3?= ... (6 Replies)
Discussion started by: twisterbr
6 Replies

3. Shell Programming and Scripting

Extract records from list

Hi Gents, I have a file 1 like this 1 1000 20 2 2000 30 3 1000 40 5 1000 50 And I have other file 1 like 2 1 I would like to get from the file 1 the complete line which are in file 2, the key to compare is the column 2 then output should be. 2 2000 30. I was trying to get it... (5 Replies)
Discussion started by: jiam912
5 Replies

4. Shell Programming and Scripting

extract columns from file and send mail

Hi I have a file of the form name1,lastname1,email1@gmail.com,9.08243E+12,team1,role1,username1,password1 name2,lastname2,email2@gmail.com,9.08243E+11,team2,role2,username2,password2 I need to extract the email (column 3) and send a mail to each person, with their details ( specifically... (3 Replies)
Discussion started by: pkabali
3 Replies

5. Shell Programming and Scripting

Extract attachment from mail and place it in a directory

Hi, I have a requiremnent that i have to read a mail from a mail box and extract the attachment from that mail and place it in a directory. First of all is it possible in unix ? if so could you please help me out how it can be done Thanks in advance. (3 Replies)
Discussion started by: krishna_gnv
3 Replies

6. UNIX for Dummies Questions & Answers

extract first occurrence in a list

Hello everyone, I need to extract an item the first time it appears in a list: Input: human pool.1 121 4e-10 75 89 human pool.1 112 2e-08 75 78 human pool.1 154 1e-07 75 72 human pool.1 122 4e-06 75 68 human pool.1 111 3e-02 75 54 Horse pool.1 222 4e-10 82 90 Horse pool.1 333 3e-09... (5 Replies)
Discussion started by: viralnerd
5 Replies

7. Infrastructure Monitoring

trap in etc/profile and user .profile

Hello I really wonder what's trap in etc/profile and in each user .profile. I try to google for it but I think I have no luck. Mostly hit is SNMP traps which I think it is not the same thing. I want to know ... 1. What's a "trap 2 3" means and are there any other value I can set... (4 Replies)
Discussion started by: Smith
4 Replies

8. Shell Programming and Scripting

Show if I have new mail in .profile ?

Is there any way to script it to tell me if I have new mail when I log-in? I'm using the bash shell. It's showing up now already but I want to put a clear in my .profile to clear the screen of the disclaimer I've seen 1000 times, I have a few echo's and a command to list the number of users... (3 Replies)
Discussion started by: eulogy1337
3 Replies

9. UNIX for Dummies Questions & Answers

changed .profile but didnt ./.profile, yet reflected changes

hi , i added ls -F to .profile. and i need to do ./.profile for the effect to take effect BUT i didnt and YET the next day when i came to work and log in, the changes took effect. i am on aix. please explain.. thanks (4 Replies)
Discussion started by: yls177
4 Replies
Login or Register to Ask a Question