Hi All,
I have input data like follows:
"1234"|"ABC"
"1234"|"CBA"
"1222"|"ZZZ"
I am trying to awk print all records where Col1 = "1234"
.
Below is the code I have so far:
Var1=1
Var2=1234
awk -F "|" "$ ${Var1} == "\"${Var2}\"" { print; }' inputfile
However when the AWK command is running, it is not enforcing that I want to find data which = "1234"
, it is just looking for data which = 1234
(i.e. without the double quotes).
Note -- The above command works fine from command line, however when running from a script, the "\ is being removed, therefore not enforcing that I want to find data with double quotes around.
Can anyone assist?