1
I found this command. If a line has interested word, the command will output the entire line:
temp="sample"
awk -F " " -v var="$temp" '$1 == var' /root/smaple.txt
smaple.txt
contains:
sample demo 123 456
sample2 demo2 567 345
sample3 demo4 453 456
Now I want to check two values i.e. If those two values in a line, the command will output the line:
temp1="sample"
temp2="123"
awk -F " " -v var="$temp1" var2="$temp2" '$1 == temp1 && $3 == temp2' /root/smaple.txt
The expected output for my command:
sample demo 123 456
But its not working.
Thanks for the replay, I tried with that also. It is not show any output or error – Veerendra – 2015-10-06T13:13:45.310