Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试 sed 插入:
echo "usr_web88_2" | sed 's/^\(usr\_\)'
但我找不到解决方案
我有这个字符串:
usr_web88_2
并希望在下划线之前添加反斜杠,如下所示:
usr\_web88\_2
有谁能够帮我?谢谢你..
echo "usr_web88_2" | sed 's/_/\\_/g'
g 表示全局,它将表达式应用于它在一行中找到的每个匹配项,而不仅仅是第一个匹配项。