sed稀有分隔符(& | / /?...除外) [英] sed rare-delimiter (other than & | / ?...)

查看:157
本文介绍了sed稀有分隔符(& | / /?...除外)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在字符串上应用Unix命令 sed 可以包含#,!,/,?,&,@和所有其他字符),可以包含所有类型的字符(&,|,!,/ 、? ...)

I've to apply the Unix command sed on a string (can contain #, !, /, ?, &, @ and all other characters) which can contains all types of character (&, |, !, /, ? ...)

它是一个复杂的定界符(带有两个caracter吗?),可以允许克服错误:

Is it a complex delimiter (with two caracters ?) which can permits to outpass the error :

sed: -e expression #1, char 22: unknown option to `s'

预先感谢

推荐答案

sed中的多字符表达式定界符没有这样的选项,但是我怀疑
是否需要它。分隔符不应出现在 pattern 中,但如果它出现在正在处理的字符串中,则不会有问题。而且,除非您做的事情非常怪异,否则搜索模式中总会出现一些字符,可以用作分隔符。

There is no such option for multi-character expression delimiters in sed, but I doubt you 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稀有分隔符(& | / /?...除外)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆