awk case insensitive and boolean operator -


i grep lines contains both patterns in order , i'm using

awk '/pattern1/ && /pattern2/' file.txt 

but if want case insensitive search, adding /i works if add pattern2.

awk '/pattern1/ && /pattern2/i' file.txt ...works  awk '/pattern1/i && /pattern2/i' file.txt ...don't, outputs whole file 

anyone know how solve this?

try:

awk '{s=tolower($0)} s~/lowercase_pattern1/ && s~/lowercase_pattern2/' file 

there possibility of ignorecase option in gnu awk..


you of time this:

grep -ei 'pattern1.*pattern2|pattern2.*pattern1' file 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -