<p><code>echo NC_037078 1:122545 124035 | sed 's/ /./1' | sed 's/ /:/g'</code></p>
<p>Note:
Reference: <a href="https://stackoverflow.com/questions/59047776/sed-replace-only-first-occurrence-then-only-second-occurrence-then-only-third">https://stackoverflow.com/questions/59047776/sed-replace-only-first-occurrence-then-only-second-occurrence-then-only-third</a></p>

CC BY-SA 4.0
2023-02-01T15:57:14.227Z
2023-02-01T15:57:14.227Z
h3ab74
<p>I'm trying to alter this string: <code>NC_037078 1:122545 124035</code> into this: <code>NC_037078.1:122545-124035</code> but I don´t know how.</p>
<p>The document is like this:\</p>
<pre><code>    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
</code></pre>
<p>The script until now looks like this:</p>
<pre><code>code=$(ls -l | grep &quot;Annotation&quot; data.txt | cut -d &quot; &quot; -f3,4 | sed 's/[(]/:/g' | sed 's/[)]/ /g' | sed 's/[,]/ /g' | sed 's/[ ]//g' | sed 's/[&quot;.&quot;]/ /g' )
</code></pre>
<p>Can you help me solving this problem?</p>

<shell>
How can I tranform this String?
# How can I tranform this String?

(Asked by: username_0 on 2023-02-01)

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?

**Tags:** shell

---

## 1 answers

### Answer by username_1 on 2023-02-01. Score: 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>


---

