I have an input file that looks like this:
What I need to have is a file that looks like this:
BOOP|BETTY|B|123456
FLINTSTONE|FRED||112233
MOUSE|MICKEY||234234
GRAPE|GOOFY|T|332233
I've tried to use
where DATA is the current line and it almost works. The problem I have is that, for those names without a middle initial, it simply leaves out the field resulting, for example, in MOUSE|MICKEY|234234 . This is going to cause problems with the receiving system as it's expecting four (4) fields.
Thought/comments/hints appreciated.
As always, thanks to all in advance.
Tom
"My mind is like a steel whatchamacallit ...
Code:
last_name first_name mi acct_nr
BOOP BETTY B 123456
FLINTSTONE FRED 112233
MOUSE MICKEY 234234
GRAPE GOOFY T 332233
BOOP|BETTY|B|123456
FLINTSTONE|FRED||112233
MOUSE|MICKEY||234234
GRAPE|GOOFY|T|332233
I've tried to use
Code:
sed 's/ */|/g' DATA
where DATA is the current line and it almost works. The problem I have is that, for those names without a middle initial, it simply leaves out the field resulting, for example, in MOUSE|MICKEY|234234 . This is going to cause problems with the receiving system as it's expecting four (4) fields.
Thought/comments/hints appreciated.
As always, thanks to all in advance.
Tom
"My mind is like a steel whatchamacallit ...