input file is:
line1 [time-1] abcdef
line2 [time-1] absde1
line3 [time-1] abcdef
line4 [time-1] zzzzzz
this command is working fine:
$ str="abcdef|zzzzzz"
$ awk '!($0~/('"$str"')$/)' test_input
line2 [time-1] absde1
following command fails:
$ str="[time-1] abcdef|[time-1] zzzzzz"
$ echo "${str}"
[time-1] abcdef|[time-1] zzzzzz
$ awk '!($0~/('"$str"')$/)' test_input
awk: fatal: Invalid range end: /([time-1] abcdef|[time-1] zzzzzz)$/
$
Is it possible to pass variable with such string to awk too?