问题描述
我在一个字符串上使用 Unix sed
命令,该字符串可以包含所有类型的字符(&
、|
、!
、/
、?
等).
I am using the Unix sed
command on a string that can contain all types of characters (&
, |
, !
, /
, ?
, etc).
是否有一个复杂的分隔符(有两个字符?)可以修复错误:
Is there a complex delimiter (with two characters?) that can fix the error:
sed: -e expression #1, char 22: unknown option to `s'
推荐答案
sed 中没有这样的多字符表达式分隔符选项,但我对此表示怀疑你需要那个.分隔符不应该出现在模式中,但是如果它出现在正在处理的字符串中,那就不是问题.除非您正在做一些非常奇怪的事情,否则总会有一些不会出现在您的搜索模式中的字符可以用作分隔符.
There is no such option for multi-character expression delimiters in sed, but I doubtyou need that. The delimiter character should not occur in the pattern, but if it appears in the string being processed, it's not a problem. And unless you're doing something extremely weird, there will always be some character that doesn't appear in your search pattern that can serve as a delimiter.
这篇关于sed 罕见分隔符(除了 & |/?...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!