Coverting Firstname <Space> Lastname into email id


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Coverting Firstname <Space> Lastname into email id
# 1  
Old 09-14-2009
Coverting Firstname <Space> Lastname into email id

I have a file like below :

bash-2.03$ cat neweamil2

Nigueel Rafferty
Thomas333 Middletonsss
Shwaita33 Ambasss
Zhi21 Caiss
Saluweh Husain
Nigueel Rafferty
Saleuikh Husainse
Desiyshskan Santhio

Need to convert firstname <space> lastname into email id .

For eg. (1st line)

Nigueel Rafferty

into

nigueel.rafferty@email.com


Pls let me know.
# 2  
Old 09-14-2009
Hi Sriram

Code:
# /bin/ksh

cat neweamil2 | while read abc
do
        fname=`echo $abc | awk '{print $1}'`
        lname=`echo $abc | awk '{print $2}'`

        echo "$fname.$lname@gmail.com" >> emailid.txt
done

Output will be

Code:
Nigueel.Rafferty@gmail.com
Thomas333.Middletonsss@gmail.com
Shwaita33.Ambasss@gmail.com
Zhi21.Caiss@gmail.com
Saluweh.Husain@gmail.com
Nigueel.Rafferty@gmail.com
Saleuikh.Husainse@gmail.com
Desiyshskan.Santhio@gmail.com

# 3  
Old 09-14-2009
Code:
echo 'Asdf Ghjk' | perl -pe 'chomp; y/A-Z/a-z/; s/ /./; $_.="\@email.com\n";'

The rest is just a loop. Or a '-i'
# 4  
Old 09-14-2009
Thanks you amit and Pludi,
# 5  
Old 09-14-2009
Or awk solution
Code:
awk 'NF{sub(" ",".");$0=tolower($0)"@gmail.com"}1' file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Merge Text with space into once cell and send email out

Please help!! This code works perfect but the only problem I am having is that is treats eg SQL Developer as separate cell/column which makes the formatting bad. I want to put SQL Developer in one cell. I attached a sample of how the output looks like. report.txt USERNAME OSUSER ... (5 Replies)
Discussion started by: lpoolfc
5 Replies

2. Shell Programming and Scripting

Generate disk space usage email alert

hi all members I have a shell script to generate disk space usage email alert if threshold is more than 80 %, now the requirement changed to keep sending alert emails for every 5% incremental usage ........ Any help would be greatly appreciated. ex - 80% , 85% ,90%,95%,100% we should get an... (6 Replies)
Discussion started by: anil529
6 Replies

3. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies

4. Shell Programming and Scripting

Send Disk Space Usage Status via email

Hi Guys, Is there any way I can write a script that sends DISK SPACE USAGE STATUS via email once a week? Thanks, (5 Replies)
Discussion started by: g4v1n
5 Replies

5. Shell Programming and Scripting

Coverting multiple lines to a single line

Hi all, I have a requirement to covert multiple lines in a comma delimited file to a single line through shell scripting. We should compare the data in the first column in each line. If it is same, then the other data should be put in the same line.Below is the sample input and expected output:... (4 Replies)
Discussion started by: Bobby_2000
4 Replies

6. Shell Programming and Scripting

Sending an email if system disk space is low

Hello i have a working script that sends me an email if system disk space is above 98%. I would like to add an extra command to the if condition. If disk space is above 98% it would also add an output of cd /var/log && du -sBM * |sort -n 2>&1 |grep -v -e "0M" -e "1M" command to the email. I'm... (2 Replies)
Discussion started by: taf130
2 Replies

7. Shell Programming and Scripting

Check and compare disk space and email it

I am very new to Linux and learning to script. This is for one of my servers at work that I have to keep track off as far as disk space and how it is used. I have tried to go line by line but little things keep chewing me up. I would appreciate any and all help or advice, and Mutt is installed on... (3 Replies)
Discussion started by: sgtjkj
3 Replies

8. Linux

Coverting a log file into XML

ID -------CODE-------DATE-------URL I have a log file with entries like this. The file has about 6 lakhs record and the size is about 42MB. I need to covert them into a XML file like <ID></ID> <CODE></CODE> <DATE></DATE> <URL></URL> I have done a logic for this and successfully done.... (0 Replies)
Discussion started by: arunkumar.in
0 Replies

9. Programming

coverting html data to text in 'c'

hi, iam reading the webpage using curl socket. so iam geting the data in html format so how can convert html data to text data ,so i can move forward. thank u, sree (3 Replies)
Discussion started by: phani_sree
3 Replies

10. UNIX Desktop Questions & Answers

coverting to xbm

Heleuw, I want to convert an image to .xbm the problem is that, wehen I convert it it is only a 2 color image,(black&white), someknowes a tool or an other solution to get the complete image to .xbm with colors and sizes etc:confused: Thnx in advance EJ =) (2 Replies)
Discussion started by: EJ =)
2 Replies
Login or Register to Ask a Question