Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. [{"cid":"PWER","data":[{"VALUE1":0}],"sid":"789069","units":"kWm","age":586667},
  2. {"cid":"PWER","data":[{"VALUE2":809}],"sid":"788325","units":"kWm","age":11},
  3. {"cid":"PWER_SUB","data":[{"VALUE3":278}],"sid":"789540","units":null,"age":1},
  4. {"cid":"PWER_SUB","data":[{"VALUE4":319}],"sid":"789093","units":null,"age":38},
  5. {"cid":"PWER_SUB","data":[{"VALUE5":0}],"sid":"789069","units":null,"age":4}
  6.  
  7. $ jq -r '.[] | select(.data[0].VALUE1) | .sid' data.json
  8. 789069
  9.  
  10. grep -oP '"sid":"d+"' file
  11.  
  12. awk '{if($0~/789069/){print $0}}' file
  13.  
  14. [{"cid":"PWER","data":[{"VALUE1":0}],"sid":"789069","units":"kWm","age":586667},
  15. {"cid":"PWER_SUB","data":[{"VALUE5":0}],"sid":"789069","units":null,"age":4}
  16.  
  17. $ sed -rn '/VALUE1/ s/.*"sid":"([0-9]+)".*/1/p' VALUE
  18. 789069
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement