Can anyone explain me the below and please tell me why it is not accepting large number of strings.

sed ':a;s/(([^,|]+)[|,].*)\2/\1/;ta;y/,/|/;s/||/|/g' file_nm

what do you call Ā«not accepting large number of stringsĀ»?

give us a representative input sample,
what the command outputs,
and what it should output.

My Input File:

AA|BB|CC
a@gmail.com,c@yahoo.co.in|a@gmail.com|a@gmail.com,g@gmail.com,d@gmail.com
y@gmail.com|x@yahoo.in,z@redhat.com|z@redhat.com
c@gmail.com|b@yahoo.co.in|c@uix.xo.in
c@gmail.com|b@yahoo.co.in|c@gmail.com,b@yahoo.co.in
by@gmail.com|by@gmail.com|ww@gmail.com

Out is coming after running the **sed ':a;s/(([^,|]+)[|,].*)\2/\1/;ta;y/,/|/;s/||/|/g' file_nm **

OutPut:
`

AA|BB|CC
a@gmail.com|c@yahoo.co.in||g|d
y@gmail.com|x@yahoo.in|z@redhat|
c@gmail.com|b@yahoo.co.in|c@uix.x
c@gmail.com|b@yahoo.co.in|
by@gmail.com|ww

`

Expected Output:

AA|BB|CC
a@gmail.com|c@yahoo.co.in|g@gmail.com|d@gmail.com
y@gmail.com|x@yahoo.in|z@redhat.com
c@gmail.com|b@yahoo.co.in|c@uix.xo.in
c@gmail.com|b@yahoo.co.in
by@gmail.com|ww@gmail.com