bash – 单引号字符的awk扫描字符串
发布时间:2020-12-16 01:56:11 所属栏目:安全 来源:网络整理
导读:我有一条线,我想知道它内是否有任何嵌入的单引号字符.使用awk,我尝试了几种变体 badix = index($0," 47") -- this does not find itbadix = index($0,"'") -- throws a fitbadix = index($0,"'") -- throws a fitbadix = index($0,') -- throws a fit 这
我有一条线,我想知道它内是否有任何嵌入的单引号字符.使用awk,我尝试了几种变体
badix = index($0," 47") -- this does not find it badix = index($0,"'") -- throws a fit badix = index($0,"'") -- throws a fit badix = index($0,') -- throws a fit 这适用于Solaris 10上的awk,因此在这种情况下gawk解决方案不适用. 有什么建议? 解决方法
你有一个shell引用问题,我怀疑你是用单引号括起awk命令,即使转义也不能包含单引号.尝试$’…’引用,其中可以包含转义单引号:
awk $'{ # Lots of other awk code... badix=index($0,"'") }' # The rest of the awk code }' (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 使用scalaz Monad的示例
- Docker为网络bridge模式指定容器ip的方法
- scala – 为什么不一些(List(1,2,3)).flatten compile?
- shell – 如何更改Docker ENV var?
- Angular 6:如何安装以前版本的Angular项目
- shell – 如何在FreeBSD中获得以毫秒为单位的时间?
- 实现bootstrap到jfinal的翻页功能
- angular-meteor – $reactive(this).attach($scope)和$scop
- angularjs ng-repeat
- 打造立体化监控体系与APM最佳实践系列 –Zipkin部署与使用