User:Timothee Flutre/Notebook/Postdoc/2012/05/25

From OpenWetWare

(Difference between revisions)
Jump to: navigation, search
(One-liners with GNU tools: add tutorial + list of other tools)
(One-liners with GNU tools: add sed examples)
Line 20: Line 20:
-
* '''Use absolute values:'''
+
* '''Skip a subset of successive lines''':
 +
for i in {1..10}; do echo $i; done | sed 3,6d
-
  awk 'function abs(x){return (((x < 0.0) ? -x : x) + 0.0)} {print abs($1)}' input.txt
+
 
 +
* '''Extract a subset of successive lines''':
 +
  for i in {1..20}; do echo $i; done | sed -n 3,5p
 +
 
 +
 
 +
* '''Use absolute values:'''
 +
for i in {-5..5}; do echo $i; done | awk 'function abs(x){return (((x < 0.0) ? -x : x) + 0.0)} {print abs($1)}'

Revision as of 11:42, 29 November 2012

Project name Main project page
Previous entry      Next entry

One-liners with GNU tools


  • Toolbox:
    • AWK
    • grep
    • sed
    • cut
    • tr
    • wc


  • Skip a subset of successive lines:
for i in {1..10}; do echo $i; done | sed 3,6d


  • Extract a subset of successive lines:
for i in {1..20}; do echo $i; done | sed -n 3,5p


  • Use absolute values:
for i in {-5..5}; do echo $i; done | awk 'function abs(x){return (((x < 0.0) ? -x : x) + 0.0)} {print abs($1)}'


awk 'BEGIN{RS=">"} {if(NF==0)next; split($0,a,"\n"); printf "@"a[1]"\n"a[2]"\n+\n"; \
for(i=1;i<=length(a[2]);i++)printf "}"; printf"\n"}' probes.fa > probes.fq


Personal tools