Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 7th, 2013  |  syntax: None  |  size: 1.11 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. 0,0,0,DP=1,1,1,1,MQ=2,2,2
  2.        
  3. 0,0,0,DP=1;1;1;1;MQ=2,2,2
  4.        
  5. sed -r 's/DP.*MQ/n&n/;h;y/,/;/;G;s/.*n(.*)n.*n(.*)n.*n/21/' file
  6.        
  7. sed -r 's/DP=[^=]*MQ=/n&n/;h;y/,/;/;G;s/.*n(.*)n.*n(.*)n.*n/21/' file
  8.        
  9. sed -r '/DP=[^=]*MQ=/{s//n&n/;h;y/,/;/;G;s/.*n(.*)n.*n(.*)n.*n/21/}' file
  10.        
  11. sed -r 's/(.*DP=)(.*)(MQ=.*)/echo -n 1;echo -n 2 |tr "," ";"; echo -n 3/ge' input
  12.        
  13. kent$  sed -r 's/(.*DP=)(.*)(MQ=.*)/echo -n 1;echo -n 2 |tr "," ";"; echo -n 3/ge' <<<"0,0,0,DP=1,1,1,1,MQ=2,2,2"
  14. 0,0,0,DP=1;1;1;1;MQ=2,2,2
  15.        
  16. awk -F"=" '{gsub(",",";",$2); $1 = $1; print $1"="$2"="$3}' temp.txt
  17.        
  18. awk -F"=" '{OFS="=";gsub(",",";",$2)}1'
  19.        
  20. > echo "0,0,0,DP=1,1,1,1,MQ=2,2,2" | awk -F"=" '{OFS="=";gsub(",",";",$2)}1'
  21. 0,0,0,DP=1;1;1;1;MQ=2,2,2
  22.        
  23. perl -plne '$_=~/DP=(.*)MQ/;$a=$1;$a=~s/,/;/g;$_=~s/(.*DP=).*(MQ.*$)/$1$a$2/g'
  24.        
  25. > echo "0,0,0,DP=1,1,1,1,MQ=2,2,2" | perl -plne '$_=~/DP=(.*)MQ/;$a=$1;$a=~s/,/;/g;$_=~s/(.*DP=).*(MQ.*$)/$1$a$2/g'
  26. 0,0,0,DP=1;1;1;1;MQ=2,2,2
  27.        
  28. perl -F"=" -ane '$F[1]=~s/,/;/g;print join "=",@F'
  29.        
  30. > echo "0,0,0,DP=1,1,1,1,MQ=2,2,2" | perl -F"=" -ane '$F[1]=~s/,/;/g;print join "=",@F'
  31. 0,0,0,DP=1;1;1;1;MQ=2,2,2