if you do not mind with Perl
first remove extra newline:
perl -pe 's/^\n//;' file
the output:
100,"John","Clerk",,,,
101,"Dannis","Manager",,,,
102,"Michael","Senior
Manager",,,,
103,"Donald","President of
united states",,,,
then what you can is: adding new substitution to remove newline of last word of each line. And for that you can use:
s/(\w+)\s+\n$/$1 /;
here \w+
matches Senior
and of
and keep them in $1
and you can use it with /$1 /
and and noticeable part is a single space:
after $1
and finally we have:
perl -pe 's/^\n//;s/(\w+)\s+\n$/==>$1<== /;' file
the output:
100,"John","Clerk",,,,
101,"Dannis","Manager",,,,
102,"Michael","==>Senior<== Manager",,,,
103,"Donald","President ==>of<== united states",,,,
NOTE:
remove ==>
and <==
and add -i.bak
for getting backup and edit-in-place
and even in a single substitution:
perl -lpe '$/=undef; s/(\w+)\s+\n\n^([^\n]+)\n/$1 $2/gm;' file