Answers.Body: <p>Either the <code>zcat</code> command or <code>gunzip -c</code> will decompress the file in a streaming fashion to the standard output without writing the decompressed data to disk. Pipe the output to <code>cut</code>, <code>sed</code>, etc.</p>
  <p>Try</p>
  <pre><code>zcat 00-All.vcf.gz | cut -f 3 | sed 's/[\t]/,/g' &gt; cols.csv
  </code></pre>
  <p>or</p>
  <pre><code>gunzip -c 00-All.vcf.gz | cut -f 3 | sed 's/[\t]/,/g' &gt; cols.csv
  </code></pre>
  <p>But if you just want a single 'column' (I presume you mean field), then you are better off just doing <code>bcftools query</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-26T15:38:32.233Z
Answers.Text: On some systems I have issues with `zcat` but `gunzip -c` will also accomplish the same result.
Answers.UserDisplayName: Daniel Standage
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-26T19:44:44.097Z
Answers.Text: @Exhausted Don't use unix utilities for this - it needs a level of expertise that your post history suggests you do not have. Use bcftools instead, that will address a lot of edge cases that you can't foresee.
Answers.UserDisplayName: Ram RS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-26T20:47:03.307Z
Answers.Text: tar can do select zip file search and extraction, but you're also data munging.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-27T11:10:19.533Z
Answers.Text: Thank you all, but why you down voting me?
Answers.UserDisplayName: Zizogolu
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-27T11:29:30.397Z
Answers.Text: I have No idea, I didn’t downvote.
Answers.UserDisplayName: user438383
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-26T15:32:54.530Z
Answers.LastActivityDate: 2022-01-26T16:05:22.977Z
Answers.LastEditDate: 2022-01-26T16:05:22.977Z
Answers.UserDisplayName: user438383
Body: <p>I have a zipped vcf file of dbSNP hg38 version</p>
  <p>No space left on my device to unzip that</p>
  <p>I want to extract a column from that</p>
  <p>I have tried this</p>
  <pre><code>cut -f 3 00-All.vcf.gz | sed 's/[\t]/,/g' &gt; cols.csv
  </code></pre>
  <p>But that needs my vcf to be unzipped</p>
  <p>Do you know any solution please?</p>
  
Tags: <vcf><snp><wes>
Title: Extracting a column from a vcf file
ThreadText: # Extracting a column from a vcf file
  
  (Asked by: username_0 on 2022-01-26)
  
  I have a zipped vcf file of dbSNP hg38 version
  
  No space left on my device to unzip that
  
  I want to extract a column from that
  
  I have tried this
  
  ```
  cut -f 3 00-All.vcf.gz | sed 's/[\t]/,/g' > cols.csv
  
  ```
  
  But that needs my vcf to be unzipped
  
  Do you know any solution please?
  
  **Tags:** vcf, snp, wes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-01-26. Score: 4 | Accepted answer
  
  Either the `zcat` command or `gunzip -c` will decompress the file in a streaming fashion to the standard output without writing the decompressed data to disk. Pipe the output to `cut`, `sed`, etc.
  
  Try
  
  ```
  zcat 00-All.vcf.gz | cut -f 3 | sed 's/[\t]/,/g' > cols.csv
  
  ```
  
  or
  
  ```
  gunzip -c 00-All.vcf.gz | cut -f 3 | sed 's/[\t]/,/g' > cols.csv
  
  ```
  
  But if you just want a single 'column' (I presume you mean field), then you are better off just doing `bcftools query`.
  
  > **Comments:**
  > **username_2**: On some systems I have issues with `zcat` but `gunzip -c` will also accomplish the same result.  
  > **username_3**: @Exhausted Don't use unix utilities for this - it needs a level of expertise that your post history suggests you do not have. Use bcftools instead, that will address a lot of edge cases that you can't foresee.  
  > **username_4**: tar can do select zip file search and extraction, but you're also data munging.  
  > **username_0**: Thank you all, but why you down voting me?  
  > **username_1**: I have No idea, I didn’t downvote.  
  
  ---
  
  