Home
Sign Up
Sign In
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member
Sign In
Distributions
›
Ubuntu
›
Fedora
›
CentOS
中文资源站
›
网易开源镜像站
V2EX
›
Linux
Linux sed 的命令
1054850490
·
Jun 9, 2022
· 3396 views
This topic created in 1431 days ago, the information mentioned may be changed or developed.
如图所示
假如我的输入为“id”
jq -r ".id" | sed "s_^_/watch?v=_"
那么这行代码会输出结果为:/watch?v=id
那么如何让他输出两个结果?假如我的输入还是 id ,但是一次性打印并替换为两份
如图下
sed
Watch
输入
输出
5 replies
•
2022-06-09 22:15:29 +08:00
1
somicimos
Jun 9, 2022
1
sed -e "s_^_/watch?v=_p" -e "s_^/watch?v=_/shorts/_"
2
1054850490
OP
Jun 9, 2022
@
somicimos
谢谢哥,问题完美解决了
3
1and0
Jun 9, 2022 via iPhone
@
somicimos
新手问下下划线是啥意思,网上没搜出来
4
somicimos
Jun 9, 2022
@
1and0
分隔符而已,也可以是#等,例如"s#^/watch?v=#/shorts/#"
5
1and0
Jun 9, 2022
@
somicimos
谢谢!
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
1034 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 40ms ·
UTC 18:29
·
PVG 02:29
·
LAX 11:29
·
JFK 14:29
♥ Do have faith in what you're doing.
❯