gpt4 book ai didi

linux - 如何在grep中转义单引号

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:37:55 24 4
gpt4 key购买 nike

我在这里发现了一些类似的问题,但它们并不完全相同。

我想对某些文件中的文本 'true' 格式 进行 grep。

我该怎么做?

不确定如何转义 true 周围的单引号。

最佳答案

只需将字符串括在双引号内:

grep "'true' format" your_file

测试

$ cat a
this is 'true' format
and this is true formatting
test

$ grep "'true' format" a
this is 'true' format

关于linux - 如何在grep中转义单引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23788000/

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