I have file data as below
and the requirement is to extract the last name and add @mail.com to it. I used the below command
cut -d"|" -f2 emp.lst | sed 's/\([a-z][a-z]*\) \([a-z][a-z]*\)/\firstname.lastname@example.org/'
-- Cut command to get the second field from the file (full name) -- Sed to separate first and last name and assign email to the last name
Everything works fine except the name
neil o'bryan and below is the result I got
Please help me how to get the name with single quote work as expected. i.e. email@example.com