如何给在grep的新生产线的模式? [英] How to give a pattern for new line in grep?

查看:85
本文介绍了如何给在grep的新生产线的模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何给在grep的新生产线的模式?
在开始新的生产线,年底新行。不是正规的前pression方式。喜欢的东西\\ n

How to give a pattern for new line in grep? New line at beginning, new line at end. Not the regular expression way. Something like \n.

推荐答案

的grep 所以没有办法进行模式匹配一​​个换行符的模式是针对个别线路匹配发现在输入

grep patterns are matched against individual lines so there is no way for a pattern to match a newline found in the input.

但是你可以找到空行是这样的:

However you can find empty lines like this:

grep '^$' file
grep '^[[:space:]]*$' file # include white spaces 

这篇关于如何给在grep的新生产线的模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆