sed 命令中的 / 可以用任意字符替换 特别地当处理网址相关问题时

官方说明:

The / characters may be uniformly replaced by any other single character within any given s command. The / character (or whatever other character is used in its stead) can appear in the regexp or replacement only if it is preceded by a \ character.

来源:

https://www.gnu.org/software/sed/manual/sed.html#The-_0022s_0022-Command


如:

sed -E 's#(http.*github[^/]*/)#https://github.crazypeace.workers.dev/\1#g'

sed -E 's/(http.*github[^/]*\/)/https:\/\/github.crazypeace.workers.dev\/\1/g'

等同。


评论

The Hot3 in Last 7 Days

酒馆SillyTavern 玩英文角色卡 也能以中文输出 设置世界书Lorebooks

Woiden IPv6 VPS 搭 V2ray 梯子 VLESS+Websocket+TLS 模式 免费 白嫖 全程手机操作 2022-4-19

极简一键脚本 搭Xray梯子 VLESS + Reality + xTLS 偷 x25519 证书