I have a text file, where each line is a set of comma separated words. I need to know if a word was repeated and if so, in what lines it was repeated. Example:
word1, word2, word3, word4, word5
word6, word4, word7, word8
output:
word4: 1,2
I am experimenting with a perl script which creates a map from words to line numbers as it reads the file line by line, but I was wondering if there is a simpler approach.
Aucun commentaire:
Enregistrer un commentaire