'How to keep header of the file when using grep?
I have two files. One very large file with a header and approx several million rows (chrall.txt.gz).
Another file (extract0.3.txt) with a single column/list of values to cross-reference the larger file. If the value match (they all should) a new file is created outputting the matched lines. I am using the grep command below:
gunzip -c chrall.txt.gz | grep -Fwf extract0.3.txt > output
However, this does not print my header line. How would I retain the header line of chrall.txt.gz
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
