Answers.Body: <blockquote>
    <p>As you are seeing, most of the name of txt files are matched</p>
  </blockquote>
  
  <p>Our eyes and brains are smarter than computers. We can see patterns that can be difficult to describe. For a computer to be useful in this task, the difference between the two file names must be explicitly defined.</p>
  
  <p>In your example (which seems to be an ANNOVAR-generated output file with a prefix specified during annovar run), the common part seems to be the output of <code>$(basename LP6005334-DNA_H01_vs_LP6005333-DNA_H01.passed.somatic.indels.vcf.parsed.txt .parsed.txt)</code>. If this is true for all files, you could automate that using a loop such as:</p>
  
  <pre><code>for f in *.parsed.txt
  do
      other_file=<span class="math-container">$(basename "$</span>f" .parsed.txt)
      # Rest of your logic goes here
  done
  </code></pre>
  
  <p>You could then <code>paste</code> the columns from <code>$f</code> to <code>$other_file</code> like so (not tested):</p>
  
  <pre><code>paste "<span class="math-container">$other_file" &lt;(cut -f3,4 $</span>f)
  </code></pre>
  
  <p>This is an outline to get to your solution. You should be able to build off this.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-17T18:17:54.557Z
Answers.Text: @terdon I'd appreciate it if you added a comment suggesting the changes instead of editing the post directly.
Answers.UserDisplayName: Ram RS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-17T18:25:37.430Z
Answers.Text: Oh. Sorry. I'm happy to do that if you prefer, I'm just very used to editing directly since that is the norm on all SE sites I participate in. But if you object I won't do it again. For what it's worth, if you see something you can improve in any of my answers, please go ahead and edit. I much prefer it :) However, others will likely also edit, it really is the expected behavior on SE sites.
Answers.UserDisplayName: terdon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-16T16:56:10.367Z
Answers.LastActivityDate: 2020-01-16T17:13:04.857Z
Answers.LastEditDate: 2020-01-16T17:13:04.857Z
Answers.UserDisplayName: Ram RS
Body: <p>I have a list of files in which I have this information</p>
  
  <pre><code>Chrom   Position        Ref Alt TumorVAF    NormalVAF
  chr1    56987           CA  C   0.222222    0
  chr1    4133415         AG  A   0.425       0
  chr1    4611030         A   AC  0.36        0
  </code></pre>
  
  <p>This is the name of one of my files</p>
  
  <pre><code>LP6005334-DNA_H01_vs_LP6005333-DNA_H01.passed.somatic.indels.vcf.parsed.txt
  </code></pre>
  
  <p>I have another matched file which has too much information</p>
  
  <p>This is the name of these big files</p>
  
  <pre><code>LP6005334-DNA_H01_vs_LP6005333-DNA_H01.passed.somatic.indels.vcf_fixed_vcf.txt.hg19_multianno.txt
  </code></pre>
  
  <p>As you are seeing, most of the name of txt files are matched</p>
  
  <p>I want to cut the 4th and 5th columns from my small files and add these columns to the matched big files</p>
  
  <p>Manually this is possible but time consuming for a lot of files</p>
  
  <p>Is these any way to do that by coding?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-16T17:14:42.330Z
Comments.Text: Note that you don't need a `.txt` extension if you're not working on Windows. `.vcf` is fine, and so is no extension at all.
Comments.UserDisplayName: terdon
Tags: <r><bash><loop>
Title: Appending some columns from one tabular file to another
ThreadText: # Appending some columns from one tabular file to another
  
  (Asked by: username_0 on 2020-01-16)
  
  I have a list of files in which I have this information
  
  ```
  Chrom   Position        Ref Alt TumorVAF    NormalVAF
  chr1    56987           CA  C   0.222222    0
  chr1    4133415         AG  A   0.425       0
  chr1    4611030         A   AC  0.36        0
  
  ```
  
  This is the name of one of my files
  
  ```
  LP6005334-DNA_H01_vs_LP6005333-DNA_H01.passed.somatic.indels.vcf.parsed.txt
  
  ```
  
  I have another matched file which has too much information
  
  This is the name of these big files
  
  ```
  LP6005334-DNA_H01_vs_LP6005333-DNA_H01.passed.somatic.indels.vcf_fixed_vcf.txt.hg19_multianno.txt
  
  ```
  
  As you are seeing, most of the name of txt files are matched
  
  I want to cut the 4th and 5th columns from my small files and add these columns to the matched big files
  
  Manually this is possible but time consuming for a lot of files
  
  Is these any way to do that by coding?
  
  **Tags:** r, bash, loop
  
  > **Comments:**
  > **username_1**: Note that you don't need a `.txt` extension if you're not working on Windows. `.vcf` is fine, and so is no extension at all.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-01-16. Score: 2
  
  > As you are seeing, most of the name of txt files are matched
  
  Our eyes and brains are smarter than computers. We can see patterns that can be difficult to describe. For a computer to be useful in this task, the difference between the two file names must be explicitly defined.
  
  In your example (which seems to be an ANNOVAR-generated output file with a prefix specified during annovar run), the common part seems to be the output of `$(basename LP6005334-DNA_H01_vs_LP6005333-DNA_H01.passed.somatic.indels.vcf.parsed.txt .parsed.txt)`. If this is true for all files, you could automate that using a loop such as:
  
  ```
  for f in *.parsed.txt
  do
      other_file=$(basename "$f" .parsed.txt)
      # Rest of your logic goes here
  done
  
  ```
  
  You could then `paste` the columns from `$f` to `$other_file` like so (not tested):
  
  ```
  paste "$other_file" <(cut -f3,4 $f)
  
  ```
  
  This is an outline to get to your solution. You should be able to build off this.
  
  > **Comments:**
  > **username_2**: @username_1 I'd appreciate it if you added a comment suggesting the changes instead of editing the post directly.  
  > **username_1**: Oh. Sorry. I'm happy to do that if you prefer, I'm just very used to editing directly since that is the norm on all SE sites I participate in. But if you object I won't do it again. For what it's worth, if you see something you can improve in any of my answers, please go ahead and edit. I much prefer it :) However, others will likely also edit, it really is the expected behavior on SE sites.  
  
  ---
  
  