Hello,
I have what is probably a simple task in text manipulation, but I just can't wrap my brain around it.
I have a text file that looks something like the following. Note that some have middle initials in the first field and some don't.
john.r.smith:john.smith@yahoo.com
george.w.bush:gwbush@whitehouse.gov
larry.doby:ldoby@hotmail.com
tom.t.hall:tom.t.hall@nashville.com
I want to end up with a file that looks something like this:
john<tab>smith<tab>john.smith@yahoo.com
george<tab>bush<tab>gwbush@whitehouse.gov
larry<tab>doby<tab>ldoby@hotmail.com
tom<tab>hall<tab>tom.t.hall@nashville.com
So, I want to split each line into two fields separated by a tab. I was able to easily do this with awk and wrote it to file.
awk -F':' '{print $1"\t"$2}' inputfile > outputfile
I want to eliminate the middle initial in field 1, if present. I can do that with sed, but how can I process only field 1 and leave field 2 intact?
Your suggestions are most welcome.