Link to home
Start Free TrialLog in
Avatar of yerruhari
yerruhari

asked on

print using awk or sed or any other means

I got a input file with the following data which contains 2 lines with 9 fields, each field seperated by tilde

id=123,abc,def~45678~12~~firstname~id2=234,bcd,def~example@mail.com~secondname~id3,345,567~example2@mail.com
id=879,bac,efa~98678~13~account~firstname~id2=314,bcd,def~example3@mail.com~secondname~id3,345,567~example3@mail.com

I need the output file in the required format

id=123~45678~12~~firstname~id2=234~example@mail.com~secondname~id3~example2@mail.com
id=879~98678~13~account~firstname~id2=314~example3@mail.com~secondname~id3~example3@mail.com

In the output file please note that id,id2,id3 need to print only untill the first comma. Also note that 4th field in first line is empty so there is nothing in between the tilde's. Please do consider that missing fields. As my data has more than 1000 lines of data.

Thanks in advance

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial