J'ai un fichier qui ressemble actuellement à ceci, par exemple:Inclure la numérotation séquentielle au texte correspondant à
>ENSOFAS001369_p |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001369,probes-probe:,probes-source:Anoplocnemis_curvipes_contig204
>ENSOFAS001369_p |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001369,probes-probe:,probes-source:Anoplocnemis_curvipes_contig204
>ENSOFAS001264_p |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001264,probes-probe:,probes-source:Anoplocnemis_curvipes_contig6359
>ENSOFAS001264_p |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001264,probes-probe:,probes-source:Anoplocnemis_curvipes_contig6359
>ENSOFAS001369_p |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001369,probes-probe:,probes-source:Alydus_pilosus_contig594
>ENSOFAS004569_p |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS004569,probes-probe:,probes-source:Alydus_pilosus_contig30341
En se concentrant sur la partie du texte entre les >
et |
symboles, je veux ajouter une numérotation séquentielle basée sur correspondant ENSOFAS
ID numériques. Autrement dit, je veux profiter de cela et faire ceci:
>ENSOFAS001369_p1 |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001369,probes-probe:,probes-source:Anoplocnemis_curvipes_contig204
>ENSOFAS001369_p2 |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001369,probes-probe:,probes-source:Anoplocnemis_curvipes_contig204
>ENSOFAS001264_p1 |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001264,probes-probe:,probes-source:Anoplocnemis_curvipes_contig6359
>ENSOFAS001264_p2 |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001264,probes-probe:,probes-source:Anoplocnemis_curvipes_contig6359
>ENSOFAS001369_p3 |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS001369,probes-probe:,probes-source:Alydus_pilosus_contig594
>ENSOFAS004569_p1 |design:coreoidea-v1,designer:forthman,probes-locus:ENSOFAS004569,probes-probe:,probes-source:Alydus_pilosus_contig30341
Je grep pour la recherche dans un textwrangler (.> ENSOFAS (\ d +) _ p (+) \ r), mais je sais que l'éditeur de texte Je ne peux pas faire ce dont j'ai besoin pour ajouter des nombres après _p
. Je pense que la version de macOS linux pourrait pour la partie de recherche est grep -E ">ENSOFAS[0-9]\{6\}_p\s|"
mais ne sais pas comment obtenir la numérotation entre _p
et l'espace blanc avant le |
. Les numéros ENSOFAS correspondants ne sont pas regroupés dans le fichier texte, mais je pourrais utiliser une sorte de tri si nécessaire.
Courte approche awk travaillé parfait! –