我如何在尴尬的记录分隔符中设置符号
我如何将符号包括在尴尬的记录分离器中。我知道这样的基本语法:
awk 'BEGIN{RS="[:.!]"}{if (tolower($0) ~ "$" ) print $0 }'
它将基于单独的记录将单行分开! 。而且:但是我也想包括诸如绿色复选标记的符号此。我很难理解语法,所以我把它放在似乎
awk 'BEGIN{RS="[:.!\u2705]"}{if (tolower($0) ~ "$" ) print $0 }'
不起作用的情况下。
样本输入是这样:
✅ Team collaboration ✅ Project organisation✅ SSO support✅ API Access✅ Priority Support
How do I include symbols into the record separator of awk. I know the basic syntax like this:
awk 'BEGIN{RS="[:.!]"}{if (tolower($0) ~ "quot; ) print $0 }'
which will separate a single line into separate records based on ! . and : but I also want to include symbols like a green checkmark this ✅
. I am having trouble understanding the syntax, so I put it in like this
awk 'BEGIN{RS="[:.!\u2705]"}{if (tolower($0) ~ "quot; ) print $0 }'
which doesnt seem to work.
Sample input is this:
✅ Team collaboration ✅ Project organisation✅ SSO support✅ API Access✅ Priority Support
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要与交替运算符(
|
)一起使用REGEX,因为您要使用的字符由三个独立的UTF8代码单位组成:e2
,9c
9c < /代码>和
85
。您可以使用
在线演示:
output:output:
请注意,
打印$ 0
是默认值>动作,无需明确使用它。You need to use a regex with an alternation operator (
|
) because the character you want to split with consists of three separate UTF8 code units:E2
,9C
and85
.You can use
See the online demo:
Output:
Note that
print $0
is a default action, no need to use it explicitly.