snipt

Ctrl+h for KB shortcuts

Bash Session

Sub-matrix of aTSV file

1
2
3
# head -n ri+(rj-ri) file.tsv | cut -f ci-cj | tail -n rj-ri+1

head -n 4 tabella.tsv | cut -f 2- | tail -n 2
https://snipt.net/embed/a45e077ccdb088dd4b2a88d17591f85d/
/raw/a45e077ccdb088dd4b2a88d17591f85d/
a45e077ccdb088dd4b2a88d17591f85d
shell-session
Bash Session
3
2019-07-18T13:02:14
True
False
False
/api/public/snipt/94047/
sub-matrix-of-atsv-file
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="gp">#</span> head -n ri+<span class="o">(</span>rj-ri<span class="o">)</span> file.tsv <span class="p">|</span> cut -f ci-cj <span class="p">|</span> tail -n rj-ri+1 </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="go">head -n 4 tabella.tsv | cut -f 2- | tail -n 2</span> </span></pre></div> </td></tr></table>
Bash, Linux

Bash

Remove CTRL+M (or use dos2unix!)

1
2
3
sed -i 's/^M//g' input_file

where '^M' is entered as 'ctl-V' and 'ctl-M'
https://snipt.net/embed/fe3250f7b1f8aec105f4656e845fcc4e/
/raw/fe3250f7b1f8aec105f4656e845fcc4e/
fe3250f7b1f8aec105f4656e845fcc4e
bash
Bash
3
2019-07-22T17:29:05
True
False
False
Sep 17, 2013 at 09:13 AM
/api/public/snipt/81460/
remove-ctrlm-or-use-dos2unix
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>sed -i <span class="s1">&#39;s/^M//g&#39;</span> input_file </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>where <span class="s1">&#39;^M&#39;</span> is entered as <span class="s1">&#39;ctl-V&#39;</span> and <span class="s1">&#39;ctl-M&#39;</span> </span></pre></div> </td></tr></table>
Bash, Linux