<pre><code>$ echo "Mtss1/Sox11/Fbn2/Mmp2/..." | tr '/' '\n' &gt; list.txt
</code></pre>

<p>For more information on <code>tr</code>: <a href="https://en.wikipedia.org/wiki/Tr_(Unix)" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Tr_(Unix)</a></p>

CC BY-SA 4.0
2019-09-27T17:35:56.163Z
It works well in my terminal, thank you so much!
Lin
CC BY-SA 4.0
2019-09-27T16:36:03.530Z
2019-09-27T16:36:03.530Z
Alex Reynolds
<p>Many ways, assuming you're on a *nix system. </p>

<ol>
<li><p><code>tr</code>. Alex <a href="https://bioinformatics.stackexchange.com/a/10503/298">already gave you</a> a fine <code>tr</code> solution, but here's another approach assuming you have an input file:</p>

<pre><code>tr / '\n' &lt; golist.txt &gt; newlist.txt
</code></pre></li>
<li><p><code>sed</code></p>

<pre><code>sed 's|/|\n|g' golist.txt &gt; newlist.txt
</code></pre>

<p>Or, to edit the original file:</p>

<pre><code>sed -i 's|/|\n|g' golist.txt
</code></pre></li>
<li><p>Perl</p>

<pre><code>perl -pe 's|/|\n|g' golist.txt &gt; newlist.txt
</code></pre>

<p>Or, to edit the original file:</p>

<pre><code>perl -i -pe 's|/|\n|g' golist.txt 
</code></pre></li>
<li><p><code>grep</code> (GNU <code>grep</code>, the default on Linux systems)</p>

<pre><code>grep -Eo '[^/]+' golist.txt &gt; newlist.txt
</code></pre></li>
</ol>

CC BY-SA 4.0
2019-09-27T17:38:58.387Z
Thank you all very much!
Lin
CC BY-SA 4.0
2019-09-27T17:40:26.833Z
@Lin you're very welcome. If one of the answers solved your issue, please take a moment to [accept it](//$$SITEURL/help/accepted-answer) by clicking on [the checkmark on the left](https://meta.stackexchange.com/a/5235/203101). That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites. Since Alex answered first, you might want to accept his.
terdon
CC BY-SA 4.0
2019-09-27T16:51:33.170Z
2019-09-27T17:03:33.350Z
2019-09-27T17:03:33.350Z
terdon
<p>In R you can use <code>tidyr</code>'s function <code>separate_rows</code>.</p>

<pre><code>install.packages("tidyr") ## if not already installed
library(tidyr)
GO_results&lt;-read.table("genes.txt")
separate_rows(GO_results, GO_results$V1, sep = "/")
</code></pre>

CC BY-SA 4.0
2019-09-30T08:26:09.477Z
2019-09-30T08:46:58.107Z
2019-09-30T08:46:58.107Z
benn
<p>I got two lists of about 300 genes from my GO analysis, like the following:</p>

<pre><code>Mtss1/Sox11/Fbn2/Mmp2/Tcf7l2/Six2/Ahr/Fat4/Lef1/Stc1/Acvr2a/Glis1/Nog/Igsf10/Twist2/Igf1/...
</code></pre>

<p>How can I convert the list to one element per row (for Venn diagram  on Venny 2.1), as:</p>

<pre><code>Mtss1
Sox11
Fbn2
Mmp2
...
</code></pre>

<go-enrichment>
How to convert a list of genes to one element per row?
# How to convert a list of genes to one element per row?

(Asked by: username_0 on 2019-09-27)

I got two lists of about 300 genes from my GO analysis, like the following:
Mtss1/Sox11/Fbn2/Mmp2/Tcf7l2/Six2/Ahr/Fat4/Lef1/Stc1/Acvr2a/Glis1/Nog/Igsf10/Twist2/Igf1/...

How can I convert the list to one element per row (for Venn diagram  on Venny 2.1), as:
Mtss1
Sox11
Fbn2
Mmp2
...

**Tags:** go-enrichment

---

## 3 answers

### Answer by username_1 on 2019-09-27. Score: 2

$ echo "Mtss1/Sox11/Fbn2/Mmp2/..." | tr '/' '\n' > list.txt

For more information on tr: https://en.wikipedia.org/wiki/Tr_(Unix)

> **Comments:**
> **username_0**: It works well in my terminal, thank you so much!  

---

### Answer by username_3 on 2019-09-30. Score: 1

In R you can use tidyr's function separate_rows.
install.packages("tidyr") ## if not already installed
library(tidyr)
GO_results<-read.table("genes.txt")
separate_rows(GO_results, GO_results$V1, sep = "/")


---

### Answer by username_2 on 2019-09-27. Score: 0

Many ways, assuming you're on a *nix system. 

tr. Alex already gave you a fine tr solution, but here's another approach assuming you have an input file:
tr / '\n' < golist.txt > newlist.txt

sed
sed 's|/|\n|g' golist.txt > newlist.txt

Or, to edit the original file:
sed -i 's|/|\n|g' golist.txt

Perl
perl -pe 's|/|\n|g' golist.txt > newlist.txt

Or, to edit the original file:
perl -i -pe 's|/|\n|g' golist.txt 

grep (GNU grep, the default on Linux systems)
grep -Eo '[^/]+' golist.txt > newlist.txt

> **Comments:**
> **username_0**: Thank you all very much!  
> **username_2**: @Lin you're very welcome. If one of the answers solved your issue, please take a moment to [accept it](//$$SITEURL/help/accepted-answer) by clicking on [the checkmark on the left](https://meta.stackexchange.com/a/5235/203101). That will mark the question as answered and is the way that thanks are conveyed on the Stack Exchange sites. Since Alex answered first, you might want to accept his.  

---

