Using awk, print all the lines where field 8 is equal to x
I really did try, but this awk thing is really hard to figure out.
file1.txt
"Georgia","Atlanta","2011-11-02","x","","","",""
"California","Los Angeles","2011-11-03","x","","","",""
"Georgia","Atlanta","2011-11-04","x","x","x","x","x"
"Georgia","Atlanta","2011-11-05","x","x","","",""
"Georgia","Atlanta","2011-11-06","x","","","",""
"Rhode Island","Providence","2011-11-07","x","","","","x"
***OUTPUT***
result1.txt
"Georgia","Atlanta","2011-11-04","x","x","x","x","x"
"Rhode Island","Providence","2011-11-07","x","","","","x"
I tried all the following with different combinations. They either printed everything or nothing. None of the following is achieving the results. What am I missing here?
awk '{$8 == "x"} {print}' file1.txt
awk -F',' '($8 == "x") {print}' file1.txt
awk '$8 == "x"' file1.txt
awk '($8 == "x")' file1.txt
awk '{$8 == "x"}' file1.txt > result1.txt
awk -F',' '($8 == "x") {print $0}' file1.txt
awk '$8 = "x"' file1.txt
awk '$8 = /x/' file1.txt
awk -F'/",/"' '{$8 == "x"}' file1.txt
awk -F'",/"' '{$8 == "x"}' file1.txt
awk -F'",/"' '{$8 == "x"}' file1.txt
Also would be great to do field 6.
Thank You.