I have a customer file now and would like to separate the names into two cells in a spreadsheet. Here is my data as an example:
SHAWN R KEEGAN
shawn r scroggin
Shawn Regan
Shawn Reilly
The first two have the middle initial so I'd like to include them in the "first name" field and the last name in the "last name" field. So what I need is a script to suck in the names in a text file and replace the last space in each line with a pipe so my data would look like this when converted:
tukuyomi@debian:~/unix.com$ cat name
SHAWN R KEEGAN
shawn r scroggin
Shawn Regan
Shawn Reilly
tukuyomi@debian:~/unix.com$ sed -r 's/(.*) (.*)$/\1|\2/' name
SHAWN R|KEEGAN
shawn r|scroggin
Shawn|Regan
Shawn|Reilly