title: AWK: Extract string between two different patterns
body: <p>I need to extract a string contained in a column of my csv.</p>
  
  <p>My file is like this:</p>
  
  <pre><code>col1;col2;col3;cleavage=10-11;
  col1;col2;col3;cleavage=1-2;
  col1;col2;col3;cleavage=100-101;
  col1;col2;col3;none;
  </code></pre>
  
  <p>So, the delimiter of my file is ";" but in column 4 I want to extract the string between "cleavage=" and a "-". What I did was to print the 2 chars after "cleavage=", but it's not always 2 chars. </p>
  
  <p>I did it this way:</p>
  
  <pre><code>awk -F "\"*;\"*" '{if (match($4,"cleavage=")) print $1";"$2";"$3";"substr($4,RSTART+9,2); else print $1";"$2";"$3";0"}' file
  </code></pre>
  
  <p>I figured out that the following should be the correct command, but how should I integrate it in the previous one?</p>
  
  <pre><code>awk "/Pattern1/,/Pattern2/ { print }" inputFile
  </code></pre>
  
  <p>Thanks for help! :)</p>
  
  <p>EDIT:
  My actual output is </p>
  
  <pre><code>col1;col2;col3;10;
  col1;col2;col3;1-;
  col1;col2;col3;10;
  col1;col2;col3;0;
  </code></pre>
  
  <p>But what I would like is:</p>
  
  <pre><code>col1;col2;col3;10;
  col1;col2;col3;1;
  col1;col2;col3;100;
  col1;col2;col3;0;
  </code></pre>