首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
Distributions
›
Ubuntu
›
Fedora
›
CentOS
中文资源站
›
网易开源镜像站
V2EX
›
Linux
Linux sed 的命令
1054850490
·
2022-06-09 08:41:06 +08:00
· 2724 次点击
这是一个创建于 867 天前的主题,其中的信息可能已经有所发展或是发生改变。
如图所示
假如我的输入为“id”
jq -r ".id" | sed "s_^_/watch?v=_"
那么这行代码会输出结果为:/watch?v=id
那么如何让他输出两个结果?假如我的输入还是 id ,但是一次性打印并替换为两份
如图下
sed
Watch
输入
输出
5 条回复
•
2022-06-09 22:15:29 +08:00
1
somicimos
2022-06-09 08:58:25 +08:00
1
sed -e "s_^_/watch?v=_p" -e "s_^/watch?v=_/shorts/_"
2
1054850490
OP
2022-06-09 09:02:47 +08:00
@
somicimos
谢谢哥,问题完美解决了
3
1and0
2022-06-09 14:59:12 +08:00 via iPhone
@
somicimos
新手问下下划线是啥意思,网上没搜出来
4
somicimos
2022-06-09 17:55:57 +08:00
@
1and0
分隔符而已,也可以是#等,例如"s#^/watch?v=#/shorts/#"
5
1and0
2022-06-09 22:15:29 +08:00
@
somicimos
谢谢!
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
4071 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 31ms ·
UTC 05:31
·
PVG 13:31
·
LAX 22:31
·
JFK 01:31
Developed with
CodeLauncher
♥ Do have faith in what you're doing.