2016-10-27 If you want to match in awk against a pattern from a shell vari- able, you have a problem of escaping the pattern correctly, be- cause otherwise the script will break, as does the following code: pat=a/b.c awk "/$pat/ {...}" In awk, you have the advantage, that it uses EREs, where each es- caped character stands for itself literally, thus you can escape just every character to match the string literally: pat=a/b.c pat=`echo "$pat" | sed 's,.,\,g'` awk "/$pat/ {...}" You can use awk's index() function in this case as well: pat=a/b.c awk "index(, $pat)>0 {...}" [0] [0] https://debianforum.de/forum/viewtopic.php?f=34&t=162733 http://marmaro.de/lue/ markus schnalke