I am trying to extract context from a file with awk
from a start pattern until an end pattern.
Here is simplified sample input to reproduce:
$ cat file
1
2
3
4
5
6
When I pass the start pattern 1
as follows it works:
$ awk '/1/,/^$/' file
1
2
3
But when I pass a variable as the start pattern I get no result:
$ awk -v var=1 '/var/,/^$/' file