vendredi 17 avril 2015

In AWK, how to split consecutive rows that have the same string as a "record"?

Let's say I have below text.



aaaaaaa
aaaaaaa
bbb
bbb
bbb
ccccccccccccc
ddddd
ddddd


Is there a way to modify the text as the following.



1 aaaaaaa
1 aaaaaaa
2 bbb
2 bbb
2 bbb
3 ccccccccccccc
4 ddddd
4 ddddd

Aucun commentaire:

Enregistrer un commentaire