Com base na sua tentativa com sed, parece que o patten que você está tentando corresponder é ">text_ e você deseja anexar um número e um " depois disso
Isso é possível com awk .
awk 'BEGIN {cnt=1} /^">text_/ { gsub("_.*$","_"cnt++"\"",$0) } { print}'
por exemplo,
$ cat x
">text_lots of other bits of text"
other lines of text
">text_lots of other bits of text"
other lines of text
">text_lots of other bits of text"
other lines of text
$ awk 'BEGIN {cnt=1} /^">text_/ { gsub("_.*$","_"cnt++"\"",$0) } { print}' x
">text_1"
other lines of text
">text_2"
other lines of text
">text_3"
other lines of text
Você pode alterar o padrão de pesquisa ^"text_ para identificar as linhas que deseja alterar e a gsub() fará a substituição; neste caso, do primeiro _ até o final da linha, é substituído por _ , em seguida, a contagem é então uma "