Answers.Body: <p>Example output of what you got and what you expected would be helpful, without these one can only guess.</p>
  
  <p>First of all your input does not have a row satisfying the criteria you have given, so I added two dummy rows, one with <code>/</code> and one with <code>|</code> used as separator.</p>
  
  <p>Here is the code I used:</p>
  
  <pre><code>awk '(<span class="math-container">$5~/1\|0/ || $</span>5~/1\/0/) &amp;&amp; (<span class="math-container">$6~/1\|0/ || $</span>6~/1\/0/) &amp;&amp; (<span class="math-container">$7~/1\|0/ || $</span>7~/1\/0/) &amp;&amp; (<span class="math-container">$8~/1\|1/ || $</span>8~/1\/1/) &amp;&amp; (<span class="math-container">$9~/0\|0/ || $</span>9~/0\/0/) &amp;&amp; (<span class="math-container">$10~/1\|0/ || $</span>10~/1\/0/) &amp;&amp; (<span class="math-container">$11~/1\|1/ || $</span>11~/1\/1/) {print}' test.txt
  </code></pre>
  
  <p>And its output (input is yours + 2 dummy rows):</p>
  
  <pre><code>Dummy  dummy D D 1/0 1/0 1/0 1/1 0/0 1/0 1/1 dummy dummy
  Dummy  dummy D D 1|0 1|0 1|0 1|1 0|0 1|0 1|1 dummy dummy
  </code></pre>
  
  <p>The code is basically yours, except for:</p>
  
  <ul>
  <li>I escaped <code>|</code> with one <code>\</code> instead of two</li>
  <li>I changed this part: <code>($10~/1\\|0/||$7~/1\/0/)</code>. I think <code>$7</code> should have been <code>$10</code></li>
  <li>I removed a <code>^</code> from one of your conditions, I believe they all should start with <code>^</code> though, per <a href="https://bioinformatics.stackexchange.com/questions/10506/awk-find-sickle-cell-anemia-from-father-mother-son-daughter/10507#10507">@terdon's answer on a related question</a></li>
  </ul>
  
  <p>I believe the code above does what you want, but when I run code above with two backslashes to escape I get the following output and could not figure out why!</p>
  
  <pre><code>1   3801895 T   C   1/0 1/0 0|0 1/0 1/0 0|0 1|1 AC=10;AN=2184   0.004578755
  1   16200229    C   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AC=9;AN=2184    0.004120879
  1   19955045    G   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AN=2184;AC=4    0.001831502
  Dummy  dummy D D 1/0 1/0 1/0 1/1 0/0 1/0 1/1 dummy dummy
  Dummy  dummy D D 1|0 1|0 1|0 1|1 0|0 1|0 1|1 dummy dummy
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-09T11:10:00.610Z
Answers.LastActivityDate: 2019-10-09T11:23:50.410Z
Answers.LastEditDate: 2019-10-09T11:23:50.410Z
Answers.UserDisplayName: haci
Body: <p>I am trying to find this pattern on a large file but the output doesn't look good. The output doesn't seem to reflect the pattern.</p>
  
  <pre><code>Father = 1|0 or 1/0
  
  Mother = 110 or 1/0
  
  Daughter 1 = 1|0 or 1/0
  
  Daughter 2 = 1|1 or 1/1
  
  Daughter 3 = 0|0 or 0/0
  
  Son 1 = 1|0 or 1/0
  
  Son 2 = 1|1 or 1/1
  </code></pre>
  
  <p>The content of the file1 looks like this</p>
  
  <pre><code>CHROM   POS REF ALT FATHER  MOTHER  DAUGHTER1   DAUGHTER2   DAUGHTER3   
  
  SON1    SON2    INFO    FREQUECY
  1   1226852 G   C   1/0 0/0 1|0 1|0 1|0 1|0 0|0 AN=2184;AC=12   0.005494505
  1   1847936 C   T   0/1 1/1 1|1 1|1 1|1 1|1 0|1 AC=1;AN=2184    0.000457875
  1   2428427 C   G   0/1 0/0 0|0 0|0 0|0 0|0 1|0 AC=4;AN=2184    0.001831502
  1   2515616 G   A   1/0 1/0 1/0 1|1 1|1 1/0 1/0 AC=1;AN=2184    0.000457875
  1   3801895 T   C   1/0 1/0 0|0 1/0 1/0 0|0 1|1 AC=10;AN=2184   0.004578755
  1   3833321 T   C   1/0 1/0 1|1 1/0 1/0 1|1 0|0 AN=2184;AC=801  0.366758242
  1   9009352 A   G   0/1 0/1 1|1 0/1 0/1 1|1 0|0 AC=90;AN=2184   0.041208791
  1   9328077 G   A   1/1 0/0 1|0 1|0 1|0 1|0 1|0 AC=1;AN=2184    0.000457875
  1   10684412    C   T   0/1 0/0 1|0 1|0 1|0 1|0 0|0 AN=2184;AC=2    0.000915751
  1   11782120    G   A   1/0 0/0 0|0 0|0 1|0 1|0 0|0 AC=3;AN=2184    0.001373626
  1   12034879    A   T   0/1 1/1 0|1 0|1 0|1 0|1 1|1 AC=3;AN=2184    0.001373626
  1   16064465    C   A   1/0 0/0 0|0 0|0 0|0 0|0 1|0 AN=2184;AC=4    0.001831502
  1   16111170    G   A   1/0 1/0 1/0 0|0 0|0 1/0 1/0 AC=1;AN=2184    0.000457875
  1   16200229    C   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AC=9;AN=2184    0.004120879
  1   16258118    C   T   0/1 0/0 1|0 1|0 1|0 1|0 0|0 AN=2184;AC=1    0.000457875
  1   17966719    A   G   0/0 0/1 0|1 0|0 0|0 0|1 0|0 AC=0;AN=2184    0
  1   19751079    CG  C   0/1 0/1 1|1 0|0 0|0 0/1 0/1 AN=2184;AC=1    0.000457875
  1   19955045    G   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AN=2184;AC=4    0.001831502
  1   21060356    G   A   1/0 1/0 1/0 1/0 1/0 1|1 0|0 AN=2184;AC=541  0.247710623
  </code></pre>
  
  <p>My awk script look like this</p>
  
  <pre><code>awk '(<span class="math-container">$8~/1\/1/ || $</span>8~/1\\|1/) &amp;&amp; (<span class="math-container">$9~/0\/0/ ||$</span>9~/0\\|0/) &amp;&amp; (<span class="math-container">$7~/^1\\|0/||$</span>7~/1\/0/) &amp;&amp; (<span class="math-container">$10~/1\\|0/||$</span>7~/1\/0/) &amp;&amp; (<span class="math-container">$10~/0\/0/ ||  $</span>10~/0\\|0/) &amp;&amp; (<span class="math-container">$5~/1\/0/|| $</span>5~/1\\|0/) &amp;&amp; (<span class="math-container">$11~/0\/1/||$</span>11~/0\\|1/)&amp;&amp; (<span class="math-container">$6~/1\\|0/||$</span>6~/1\/0/) &amp;&amp; ($12 ~/1\/1/ ||12~/1\\|1/){print}' file1 &gt;file2
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-09T08:20:48.797Z
Comments.Text: What's wrong with the output? "Doesn't look good" isn't very informative. Please [edit] your question and highlight what is going wrong.
Comments.UserDisplayName: terdon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-09T08:37:47.463Z
Comments.Text: The output doesn't reflect the pattern.
Comments.UserDisplayName: user11766958
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-09T08:40:23.570Z
Comments.Text: Well yes, I imagine so. But since this is a really complex pattern, it would be very helpful if you could show the output you get and explain why it is wrong. I [wrote you](https://bioinformatics.stackexchange.com/a/10507/298) the script you're using, and I still don't see what the issue is.
Comments.UserDisplayName: terdon
Tags: <awk>
Title: awk find pattern
ThreadText: # awk find pattern
  
  (Asked by: username_0 on 2019-10-09)
  
  I am trying to find this pattern on a large file but the output doesn't look good. The output doesn't seem to reflect the pattern.
  
  ```
  Father = 1|0 or 1/0
  
  Mother = 110 or 1/0
  
  Daughter 1 = 1|0 or 1/0
  
  Daughter 2 = 1|1 or 1/1
  
  Daughter 3 = 0|0 or 0/0
  
  Son 1 = 1|0 or 1/0
  
  Son 2 = 1|1 or 1/1
  
  ```
  
  The content of the file1 looks like this
  
  ```
  CHROM   POS REF ALT FATHER  MOTHER  DAUGHTER1   DAUGHTER2   DAUGHTER3   
  
  SON1    SON2    INFO    FREQUECY
  1   1226852 G   C   1/0 0/0 1|0 1|0 1|0 1|0 0|0 AN=2184;AC=12   0.005494505
  1   1847936 C   T   0/1 1/1 1|1 1|1 1|1 1|1 0|1 AC=1;AN=2184    0.000457875
  1   2428427 C   G   0/1 0/0 0|0 0|0 0|0 0|0 1|0 AC=4;AN=2184    0.001831502
  1   2515616 G   A   1/0 1/0 1/0 1|1 1|1 1/0 1/0 AC=1;AN=2184    0.000457875
  1   3801895 T   C   1/0 1/0 0|0 1/0 1/0 0|0 1|1 AC=10;AN=2184   0.004578755
  1   3833321 T   C   1/0 1/0 1|1 1/0 1/0 1|1 0|0 AN=2184;AC=801  0.366758242
  1   9009352 A   G   0/1 0/1 1|1 0/1 0/1 1|1 0|0 AC=90;AN=2184   0.041208791
  1   9328077 G   A   1/1 0/0 1|0 1|0 1|0 1|0 1|0 AC=1;AN=2184    0.000457875
  1   10684412    C   T   0/1 0/0 1|0 1|0 1|0 1|0 0|0 AN=2184;AC=2    0.000915751
  1   11782120    G   A   1/0 0/0 0|0 0|0 1|0 1|0 0|0 AC=3;AN=2184    0.001373626
  1   12034879    A   T   0/1 1/1 0|1 0|1 0|1 0|1 1|1 AC=3;AN=2184    0.001373626
  1   16064465    C   A   1/0 0/0 0|0 0|0 0|0 0|0 1|0 AN=2184;AC=4    0.001831502
  1   16111170    G   A   1/0 1/0 1/0 0|0 0|0 1/0 1/0 AC=1;AN=2184    0.000457875
  1   16200229    C   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AC=9;AN=2184    0.004120879
  1   16258118    C   T   0/1 0/0 1|0 1|0 1|0 1|0 0|0 AN=2184;AC=1    0.000457875
  1   17966719    A   G   0/0 0/1 0|1 0|0 0|0 0|1 0|0 AC=0;AN=2184    0
  1   19751079    CG  C   0/1 0/1 1|1 0|0 0|0 0/1 0/1 AN=2184;AC=1    0.000457875
  1   19955045    G   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AN=2184;AC=4    0.001831502
  1   21060356    G   A   1/0 1/0 1/0 1/0 1/0 1|1 0|0 AN=2184;AC=541  0.247710623
  
  ```
  
  My awk script look like this
  
  ```
  awk '($8~/1\/1/ || $8~/1\\|1/) && ($9~/0\/0/ ||$9~/0\\|0/) && ($7~/^1\\|0/||$7~/1\/0/) && ($10~/1\\|0/||$7~/1\/0/) && ($10~/0\/0/ ||  $10~/0\\|0/) && ($5~/1\/0/|| $5~/1\\|0/) && ($11~/0\/1/||$11~/0\\|1/)&& ($6~/1\\|0/||$6~/1\/0/) && ($12 ~/1\/1/ ||12~/1\\|1/){print}' file1 >file2
  
  ```
  
  **Tags:** awk
  
  > **Comments:**
  > **username_1**: What's wrong with the output? "Doesn't look good" isn't very informative. Please [edit] your question and highlight what is going wrong.  
  > **username_0**: The output doesn't reflect the pattern.  
  > **username_1**: Well yes, I imagine so. But since this is a really complex pattern, it would be very helpful if you could show the output you get and explain why it is wrong. I [wrote you](https://bioinformatics.stackexchange.com/a/10507/298) the script you're using, and I still don't see what the issue is.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-10-09. Score: 2 | Accepted answer
  
  Example output of what you got and what you expected would be helpful, without these one can only guess.
  
  First of all your input does not have a row satisfying the criteria you have given, so I added two dummy rows, one with `/` and one with `|` used as separator.
  
  Here is the code I used:
  
  ```
  awk '($5~/1\|0/ || $5~/1\/0/) && ($6~/1\|0/ || $6~/1\/0/) && ($7~/1\|0/ || $7~/1\/0/) && ($8~/1\|1/ || $8~/1\/1/) && ($9~/0\|0/ || $9~/0\/0/) && ($10~/1\|0/ || $10~/1\/0/) && ($11~/1\|1/ || $11~/1\/1/) {print}' test.txt
  
  ```
  
  And its output (input is yours + 2 dummy rows):
  
  ```
  Dummy  dummy D D 1/0 1/0 1/0 1/1 0/0 1/0 1/1 dummy dummy
  Dummy  dummy D D 1|0 1|0 1|0 1|1 0|0 1|0 1|1 dummy dummy
  
  ```
  
  The code is basically yours, except for:
  
  * I escaped `|` with one `\` instead of two
  * I changed this part: `($10~/1\\|0/||$7~/1\/0/)`. I think `$7` should have been `$10`
  * I removed a `^` from one of your conditions, I believe they all should start with `^` though, per [@username_1's answer on a related question](https://bioinformatics.stackexchange.com/questions/10506/awk-find-sickle-cell-anemia-from-father-mother-son-daughter/10507#10507)
  
  I believe the code above does what you want, but when I run code above with two backslashes to escape I get the following output and could not figure out why!
  
  ```
  1   3801895 T   C   1/0 1/0 0|0 1/0 1/0 0|0 1|1 AC=10;AN=2184   0.004578755
  1   16200229    C   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AC=9;AN=2184    0.004120879
  1   19955045    G   A   0/0 1/0 0|0 0|1 0|1 0|0 0|1 AN=2184;AC=4    0.001831502
  Dummy  dummy D D 1/0 1/0 1/0 1/1 0/0 1/0 1/1 dummy dummy
  Dummy  dummy D D 1|0 1|0 1|0 1|1 0|0 1|0 1|1 dummy dummy
  
  ```
  
  
  ---
  
  