I have a list of names and email addresses, like this. The <tab> markers are actually tabs.
joe.blow <tab>
joe.blow@wherever.com
tom.t.hall <tab>
tom.t.hall@wherever.com
john.r.smith <tab>
john.r.smith@wherever.com
sally.jones <tab>
sally.jones@state.or.us
I want to parse the data so that it will result in this:
joe <tab> blow <tab>
joe.blow@wherever.com
tom <tab> hall<tab>
tom.t.hall@wherever.com
john <tab> smith <tab>
john.r.smith@wherever.com
sally <tab> jones <tab>
sally.jones@state.or.us
So, all I need to do is remove the dot, if present, in the first part of each line. The second part (the email address) goes untouched.
So, I can easily use sed to go through and replace a 'character dot character', since sed looks for the first occurrence on each line, like this:
sed 's/\.[a-z]\./ /' emailfile.txt
That results in this:
joe.blow <tab>
joe.blow@wherever.com
tom <tab> hall <tab>
tom.t.hall@wherever.com
john <tab> smith <tab>
john.r.smith@wherever.com
sally.jones <tab>
sally.jones@state.or.us
If I run that sed command again, it will modify the email part (character.dot.character).
How can I get the result I need? Is sed the best tool for this?