I'm trying to alter this string: NC_037078 1:122545 124035 into this: NC_037078.1:122545-124035 but I don´t know how.

The document is like this:\

    1. rrn16 \
16S ribosomal RNA [Genlisea aurea]\
Other Aliases: C7J69_pgr001, BK572_Gau_0120\
Genomic context: Chloroplast\
Annotation:  NC_037078.1 (122545..124035, complement)\
ID:` 36166080

The script until now looks like this:

code=$(ls -l | grep "Annotation" data.txt | cut -d " " -f3,4 | sed 's/[(]/:/g' | sed 's/[)]/ /g' | sed 's/[,]/ /g' | sed 's/[ ]//g' | sed 's/["."]/ /g' )

Can you help me solving this problem?


1 Answer 1


echo NC_037078 1:122545 124035 | sed 's/ /./1' | sed 's/ /:/g'

Note: Reference: https://stackoverflow.com/questions/59047776/sed-replace-only-first-occurrence-then-only-second-occurrence-then-only-third


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.