使用grep时如何保留文件头?
我有两个文件。一个非常大的文件,带有标题和大约数百万行 (chrall.txt.gz)。
另一个文件 (extract0.3.txt) 具有单列/值列表,用于交叉引用较大的文件。如果值匹配(它们都应该),则会创建一个新文件并输出匹配的行。我正在使用下面的 grep 命令:
gunzip -c chrall.txt.gz | grep -Fwf extract0.3.txt > output
但是,这不会打印我的标题行。我将如何保留 chrall.txt.gz 的标题行
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论