mardi 10 novembre 2015

Shell script for how to remove multiple occurences of words except the first one

I have an file with the following:

H200:hostname1,hostname2,hostname3

H400:hostname4,hostname1,hostname5

H500:hostname2,hostname6,hostname4,hostname7

H700:hostname8,hostname5,hostname2,hostname7

I need to remove duplicate hostnames from the whole file and the output should look like this, where each line contains unique hostnames:

H200:hostname1,hostname2,hostname3

H400:hostname4,hostname5

H500:hostname6,hostname7

H700:hostname8

Aucun commentaire:

Enregistrer un commentaire