本文介绍了Linux中,打印所有行的文件,而不是与开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打印一个文件的内容,但以#开头的所有行我想忽略。我尝试一些东西使用grep和awk,但它一直在打印整个文件,或只是打印开始#行。我你能给我以正确的方式一推,或的grep / awk命令,将不以#开头的文件中打印苯胺。
I would like to print the contents of a file, but all lines starting with # I want to ignore. I was trying some stuff with grep and awk, but it kept printing the whole file, or just printed the lines starting with #. I you could give me a push in the right way, or a grep/awk command that would print anyline in the file that does not start with #.
推荐答案
使用的grep
的 -v
选项否定条件:
grep -v '^#' file
这篇关于Linux中,打印所有行的文件,而不是与开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!