I am doing a ldapsearch query which returns the results as follow
John Joe jjoe@company.com +1 916 662-4727 Ann Tylor Atylor@company.com (987) 654-3210 Steve Harvey sharvey@company.com 4567893210 (321) 956-3344 ...
As you can see between each personal record output there is a blank space and the phone numbers might start with +1 or not and might have blank between the numbers or parenthesis and finally between personal records there are two blank spaces. For example:
I would like to transform these entries to the following format:
John,Joe,jjoe@company.com,(916) 662-4727
Ann,Tylor,Atylor@company.com,(987) 654-3210
Steve,Harvey,sharvey@company.com,(456) 789-3210,(321) 956-3344
...
So basically replace the one blanks with one comma "," and two blanks with , so that at the end I have one personal record (comma separated) per line. Example:
I am trying awk and have managed to replace with "," which makes
<blank><blank> to double comma ",,".
But can't figure out how to turn ",," to <RETURN>
11/22/2017 ----****** UPDATE ******--------- 11/22/2017
I made this track too crowded. I will post a fresh questions with more details.