为什么没有用grep在这种情况下返回整条生产线? [英] Why doesn't grep return the whole line in this case?

查看:114
本文介绍了为什么没有用grep在这种情况下返回整条生产线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Mac OSX的终端练。

I am practicing using the terminal in Mac OSX.

我去了的/ dev / 文件夹的根目录,并希望查找包含行,所以我做了 LS 来获得该文件夹的内容。有很多,所以我认为这是使用的grep 的机会。所以我输入 LS | grep的空,只是回来而不是全线空ttyp9 作为在正常 LS所示上市。

I went to the /dev/ folder from root, and wanted to look for the line containing null, so I did ls to get the folder contents. There was a lot, so I saw this as an opportunity to use grep. So I typed ls | grep "null" and simply got back null instead of the full line null ttyp9 as shown in the normal ls listing.

这是怎么回事?我以为的grep 返回全行?

Why is this happening? I thought grep returned full lines?

推荐答案

ttyp9 不同的文件。

LS 正显示出你的输出列。

ls is showing you columns of output.

在没有发送到终端 LS 并没有做到这一点,就如同你使用了 1 参数。

When not sent to the terminal ls doesn't do that and acts as if you used the -1 argument.

这篇关于为什么没有用grep在这种情况下返回整条生产线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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