mardi 2 octobre 2018

Find the most common pattern in each line

I have text file like this:

a,a,b,bb,c,d

FF,ab,ab,ab,fc

H,hh,hh,u,s

H,hh,hh,u,s hh

How I can extract the most common pattern in each line? The expected output would would be :

a,a,b,bb,c,d a

FF,ab,ab,ab,fc ab

H,hh,hh,u,s hh

Please, how I can do that in linux or python? Thanks in advance DD

Aucun commentaire:

Enregistrer un commentaire