Email ids from gecos

 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support Email ids from gecos
# 1  
Old 04-14-2014
Email ids from gecos

I would like to extract only the email ids from the gecos of each user id. I have to get the email ids of all the users on the server like this.
Can someone please assist me with the command/script?
# 2  
Old 04-14-2014
Can you give us the example of what you are expecting with sample data
# 3  
Old 04-14-2014
Here is an example. When you do a
Code:
lsuser <username>

you have a field called gecos which has values like this
Code:
 gecos=GOPALAKRISHNAN, GAYATHRI; 123/P/11111 ;gg@abc.com

Like this, it will be there for every user id on the system. I would like to get only the email id portion of the gecos field extracted.

Last edited by Scrutinizer; 04-14-2014 at 05:20 AM.. Reason: code tags
# 4  
Old 04-14-2014
Code:
lsuser <username> | awk '/^gecos=/ {print $NF}' FS=';'

# 5  
Old 04-14-2014
It's not working. Sorry.
# 6  
Old 04-14-2014
Whats the output you get when you run the above command

---------- Post updated at 04:19 AM ---------- Previous update was at 03:59 AM ----------

Also, please provide the output of lsuser <username>. I dont have that installed on our system / I dont have sccess to it.
When I did testing with the data you have provided, it worked for me.
Code:
$ echo "Srini
> gecos=GOPALAKRISHNAN, GAYATHRI; 123/P/11111 ;gg@abc.com
> Random line again" | awk '/^gecos=/ {print $NF}' FS=';'
gg@abc.com
$

# 7  
Old 04-14-2014
Output is nothing. It just returns to the prompt.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Email IDs added to .mailrc aliases not receiving mails

hi, I added an email id to a list of existing aliases in .mailrc on my unix box, using vi editor. However, the new id has not been receiving any mails from the box. Kindly help as to what needs to be done here. Does the box need to be rebooted for these changes to reflect? Is there any other... (5 Replies)
Discussion started by: qwerty000
5 Replies

2. Shell Programming and Scripting

How to send mails based on email ids residing in table?

Hello Gurus, I have one table which consists of two field:- PROG_NAME EMAIL xxxx email1,email2,email3 yyyy email4,email1,email2 I want to to send mails by using mailx command. But how do I get each and every mail ids from table against... (4 Replies)
Discussion started by: pokhraj_d
4 Replies

3. Shell Programming and Scripting

Masking email ids / phone no's in file along with obscene words

Hi, I would like to know if there is a way to mask obscene words and other contents like email id's/phone numbers in the file. Below is the sample input /output. Sample data : cat smp.txt The service is really bad . My email abc@gmail.com You can contact me at 4078909831 Output... (2 Replies)
Discussion started by: ashwin3086
2 Replies

4. Shell Programming and Scripting

Shell Script for generating NTIDs(Usernames) from the email ids which exists in MSAD Directory

Hi Everyone, I just need a shell script which automatically gives the list of NT IDs mean the Usernames from the list of email ids. We have around 140 users from AMERICAS,ASIAPACIFIC and EMEA User Directories and we have their email ids.For ex. i have email id called naveen-kumar.dasu@hp.com... (7 Replies)
Discussion started by: naveen.dasu
7 Replies

5. Emergency UNIX and Linux Support

Script for deleting orphan ids & unknown gecos

The AIX servers that I am working on have been identified as having orphaned user ids & improper gecos for some user ids. Can someone help me with a script to delete the user ids if the orphaned ids are provided in a text file. The home directory set up for the user ids happen to be the... (1 Reply)
Discussion started by: ggayathri
1 Replies

6. UNIX for Dummies Questions & Answers

Email ids trucated in Mailx function

I wanted to send email to list of people using mailx in unix. I am getting the emailds from a oracle table and getting the ids in a variable. Shell script is shown below: ----------------------------------------------------------------------- filename=testdata921 export filename... (5 Replies)
Discussion started by: sasi02
5 Replies

7. Shell Programming and Scripting

Send Email to group ids

hi, I want to send mail to DL... i am sending email to single id using mailx .. how to send to group of ids? :confused: i am using a file which conatins all the ids, is there any other way to send mail without creating the DLfile? DL=path\file.txt mailx -s "Info BG is now... (4 Replies)
Discussion started by: sreelu
4 Replies

8. HP-UX

Sending email to multiple IDs

Hi, I am trying to send an email to multiple IDs from Unix script. I have given the EmailIds in a file and trying to use the file as input in the script. > cat Email EmailID = "abc@xyz.com cbz@xyz.com" In my script I have . /Email mailx -s "subj" $EmailID This fails with the... (3 Replies)
Discussion started by: sangharsh
3 Replies

9. UNIX for Dummies Questions & Answers

Sending mails to various users without hard coding the email IDS

Hi Can any one help me out ? I am trying to send an autogenerated mail with an attachment to bulk of users using 'MAILX' and 'UNENCODE' . I have used it as follows X " ( cat /sastemp/body.txt; uuencode Test.xls.gz Test.xls.gz ) | mailx -s 'Testing' ' abcd@yahoo.com , efgh@gmail.com ' " ... (9 Replies)
Discussion started by: manas6
9 Replies

10. Forum Support Area for Unregistered Users & Account Problems

Please list email ids or contact info of members

Hi , Is it possible to list the user's email id for further communication. Thanks, MoonwalaPL (3 Replies)
Discussion started by: moonwalapl
3 Replies
Login or Register to Ask a Question