echo "abc: cdef" | awk -v var=abc -F: '/$var/{print $2}'
I want to match the line contains abc but the "abc" need a variable "var" to instead, this doesn't work. any help?
Thanks
echo "abc: cdef" | awk -v var=abc -F: '/$var/{print $2}'
I want to match the line contains abc but the "abc" need a variable "var" to instead, this doesn't work. any help?
Thanks
echo "abc: cdef" | awk -v var=abc -F: '$0~var{print $2}'
oops..
Use elixir solution..
var is awk variable and not a shell one.
Or
Edited in original post ..
Thanks a lot...![]()
I don't know why it can't use /blashblash/