gpt4 book ai didi

具有存在文件名的linux grep命令

转载 作者:太空宇宙 更新时间:2023-11-04 10:34:27 24 4
gpt4 key购买 nike

我是 Linux 新手。当我输入 grep filename 并按下 enter 时,它显示了一个带光标的空行,我不得不按下 ctrl+zctrl+c 退出。它不应该向我显示命令不完整的某种错误吗?简而言之,我输入 grep filename 并按下 enter 后发生了什么。

Here is my commands

最佳答案

当您键入 grep test1 时,test1 不是文件名,而是您正在搜索的模式,您的输入文件是 stdin。因此,您的控制台输入将是您的“输入文件”。您可以看到,当您输入包含字符串“test1”的行时,在这种情况下,模式匹配并立即在控制台上再次打印出来。

参见 here对于它的手册页

grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name)

关于具有存在文件名的linux grep命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38288303/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com