IGNORECASE在AWK [英] ignorecase in AWK
本文介绍了IGNORECASE在AWK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的命令按预期工作。
The following command is working as expected.
# some command | awk '/(\<^create\>|\<^alter\>|\<^drop\>)/,/;/'
create table todel1 (id int) max_rows=2
/*!*/;
alter table todel1 engine=InnoDB
/*!*/;
create database common
/*!*/;
create database rules
/*!*/;
但是,只有较低的情况下,创造,改变等,我想用IGNORECASE开关awk的语句,以便将返回搜索词的所有实例。匹配
But it matches only the lower case "create", "alter" etc. I want to use IGNORECASE switch in the awk statement so that it will return all instances of the search term.
推荐答案
添加 IGNORECASE = 1;
您awk命令的,像这样开头:
Add IGNORECASE = 1;
to the beginning of your awk command like so:
bash-3.2$ echo "Create" | awk '/^create/;'
bash-3.2$ echo "Create" | awk 'IGNORECASE = 1;/^create/;'
Create
这篇关于IGNORECASE在AWK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文