Sunday, June 03, 2001

Converting First Name, Middle Name and Last Name to Email ID's

I had a List in Which First, Middle and Last Names were mentioned, Our email ID's are Created based on Firstname.lastname pattern

So I needed to Convert this First, Middle and last name in to Email id format.

Arranging First Name, Middle Name Last Name to email ID.

Converting a Upper case Letter case to Lower case in Vi Editor

Open the file name in vi and give this command to convert all uppercase to
lower case :

Solution

:%s/.*/\L&/

Replacing Double Space with Single Space

:%s/2space/1space/g

Now use Awk Variables to list only first and last names in the files

awk '{print $1,$NF }' filename > outputfile.txt

Replacing space with dot

:%s/1space/./g

Adding @wnsgs.com to Last line

cat file.txt | awk '{ print $0"@wnsgs.com" }' > newfile.txt

thats it !!!

No comments: