I want to add word boundaries to this awk command:
awk '{$0=tolower($0)};/wordA/&&/wordB/ { print FILENAME ":" $0; }' myfile.txt
I tried adding \y
at left and right of wordA
and wordB
but it didn't work in my tests.
I tried this: /\ywordA\y/&&/\ywordB\y/
Thanks all!
(ps: I'm new to awk so I was trying to avoid the match() function.)
}
s than{
s. – Zanezaneski\b
word boundaries: the one you get when you run it through a2p. :) – Monocarpica2p someawkcode | perl
is the awk-to-perl translator. That way you can get real perl regexes. – Monocarpic