I have at hand a text file containing 690 entries similar to what is shown in the P.S. (shown in P.S. is an example, from here http://www.ncbi.nlm.nih.gov/nuccore/AB753792.1). In my text file entries are separated by "//".
In my case after the "ACCESSION " (String and 3 spaces) there is no upper-case alphanumeric string (such as "AB753792" in P.S.). I am running MacOSX Yosemite with the default Bash and would like to fill the 690 empty spaces with unique upper-case alphanumeric strings such as generated by:
openssl rand -hex 4 | tr '[:lower:]' '[:upper:]'
(5.1.15: I have changed the above command, it was different in the first version of this post)
I can see how sed / awk could be a solution to this problem, but I can't figure out how sed would be able to insert a unique 8 digit upper case alphanumeric string after each "ACCESSION ".
I would be happy to receive help.
Kind regards,
Paul
P.S.
LOCUS AB753792 712 bp DNA linear INV 26-JUN-2013
DEFINITION Acutuncus antarcticus mitochondrial gene for cytochrome c oxidase
subunit 1, partial cds.
ACCESSION AB753792
VERSION AB753792.1 GI:478246768
KEYWORDS .
SOURCE mitochondrion Acutuncus antarcticus
ORGANISM Acutuncus antarcticus
Eukaryota; Metazoa; Ecdysozoa; Tardigrada; Eutardigrada; Parachela;
Hypsibiidae; Acutuncus.
REFERENCE 1
AUTHORS Kagoshima,H., Imura,S. and Suzuki,A.C.
TITLE Molecular and morphological analysis of an Antarctic tardigrade,
Acutuncus antarcticus
JOURNAL J. Limnol. 72 (s1), 15-23 (2013)
REFERENCE 2 (bases 1 to 712)
AUTHORS Kagoshima,H. and Suzuki,A.C.
TITLE Direct Submission
JOURNAL Submitted (07-OCT-2012) Contact:Hiroshi Kagoshima Transdisciplinary
Research Integration Center/Nationlal Institute of Genetics; 1111
Yata, Mishima, Shizuoka 411-8540, Japan
FEATURES Location/Qualifiers
source 1..712
/organism="Acutuncus antarcticus"
/organelle="mitochondrion"
/mol_type="genomic DNA"
/isolation_source="moss sample (Bryum pseudotriquetrum,
Bryum argenteum, and Ceratodon purpureus)"
/db_xref="taxon:467037"
/country="Antarctica: East antarctica, soya coast,
Skarvsnes and Langhovde"
CDS <1..712
/codon_start=2
/transl_table=5
/product="cytochrome c oxidase subunit 1"
/protein_id="BAN14781.1"
/db_xref="GI:478246769"
/translation="GQQNHKDIGTLYFIFGVWAATVGTSLSMIIRSELSQPGSLFSDE
QLYNVTVTSHAFVMIFFFVMPILIGGFGNWLVPLMISAPDMAFPRMNNLSFWLLPPSF
MLITMSSMAEQGAGTGWTVYPPLAHYFAHSGPAVDLTIFSLHVAGASSILGAVNFIST
IMNMRAPSISLEQMPLFVWSVLLTAILLLLALPVLAGAITMLLLDRNFNTSFFDPAGG
GDPILYQHLFWFFGHPEV"
ORIGIN
1 tggtcaacaa aatcataaag atattggtac actttatttt atttttggag tatgagctgc
61 tacagtagga acatctctta gtatgattat ccggtcagaa cttagacaac caggatcact
121 cttctcagat gaacaacttt acaacgttac agtaacaaga catgcatttg tcataatttt
181 cttttttgta atacccatcc ttattggagg atttggaaat tgactagtac ctttaatgat
241 ttcagcacca gatatagctt tcccccgaat aaataacctg agattctgac tactaccccc
301 atcttttata ttaattacta taagaagtat agcagaacaa ggagccggga cagggtgaac
361 agtttacccc cctttagctc actattttgc acactcagga ccagctgtcg atttaactat
421 tttttctctg catgtagcag gagcatcgtc gattttagga gccgtaaact tcatttctac
481 aattatgaat atgcgagctc catcaattag tttagaacaa atgccactat ttgtatgatc
541 agtactactt acagccattt tacttctact agctctgcca gtattagcag gagccatcac
601 aatgctttta ttagaccgaa attttaacac atcgtttttt gatcctgctg gtgggggaga
661 tccaattctc tatcaacatt tattttgatt ttttggtcac cctgaagttt aa
//