Let's say that I've Python dictionary text which i edited to be human readable. so it's now line by line as the following input.
Input
{"case":"0901","emailed":"yes","vote":1,"accepted":"no"},
{"case":"0908","emailed":"yes","vote":8,1"accepted":"yes"},
{"case":"0911","emailed":"no","vote":10,1"accepted":"yes"},
{"case":"0090","emailed":"yes","vote":3,1"accepted":"no"},
** ALL THE TEXT FILE IN THE PREVIOUS FORMAT **
So i would like to grep lines which include yes
in first and no
in second
So am expecting output to be like this
Output
{"case":"0901","emailed":"yes","vote":1,"accepted":"no"},
{"case":"0090","emailed":"yes","vote":3,1"accepted":"no"},
I were unable to find a way to grep by order of words yet.
And My second question is regarding my output ?
if i can use awk
sum
function in order to calculate the total of vote? which should be 4,1
from the output.
"vote":3,1"accepted":"no"
-- whats that1
doing in there?""
is the number of vote""
- there are onlycase
numbers between""
in your input (like"0901"
)"vote":3,1
is definitely invalid notation to be a Python dictionary - it could not workvote
the numbers displayed like that:3,1