How to to pass variable to the below awk command
I would like to pass variables to the awk command instead of the constants "a/cc" but I don't know exactly the correct syntax
You really want to avoid expanding shell parameters into awk code unless you are absolutely sure that they will not contain any characters that are special to awk. When possible, it's always preferable to use awk's -v option (demonstrated in some of the preceding examples) to pass values into awk from without.
Thnx for the info but I tried all the alternatives but still not working
here is another example
file.txt
cc
f
LST GCELL:
aas
la
laaa
When I tried to get the text pattern between "LST GCELL:" and "la" without using variables it works fine but when using the variables still not working!
# first="LST GCELL:"
# awk '/'$first'/,/la/' file.txt
# awk: syntax error near line 1
# awk: bailing out near line 1