gpt4 book ai didi

linux - 这一行脚本有什么作用?

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

sed -n 's/^@(#)*/    /p'

此 sed 命令的输入通过管道输入。但是,我很难理解这个表达式 's/^@(#)*//p'

最佳答案

如果该行以连续字符 @ (# 后跟字符 ) 组成的字符串开头 code> 重复零次或多次,然后在将上述字符串替换为 4 个空白字符后打印该行。不打印所有其他行:

$ cat file
X@(#)*1
@(#))))2
@(#)*3
@(#)4
@(#5
@(6

$ sed -n 's/^@(#)*/ /p' file
2
*3
4
5

关于linux - 这一行脚本有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32712223/

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