curl输出JSON解析数据

时间:2018-10-14 07:26:39

标签: curl awk sed grep cut

我的代码:

curl  -i -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'      -H 'accept-language: en-US,en;q=0.9,fa;q=0.8'           -H 'cookie: mcd=3; ig_cb=1; mid=W4PfJAAEAAE1DGjnE45SEwFztzbV; datr=21W0WyyVPxIwsY2Jhsnrt-69; csrftoken=6JeciuKt08Paw4WtaDtQtXoZDQZi4tzr; rur=ATN; urlgen="{\"x.x.x.x\": 31549}:1gBa8v:CMSLGwfUFGiJZYOY-Rj6KLIRPmQ"'                       -H 'upgrade-insecure-requests: 1'                       -H 'user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'     'https://www.instagram.com/web/search/topsearch/?context=blended&query=Mehran&rank_token=0.6063273796342663&include_reel=false'

我带有cURL的输出GET响应是:

HTTP/2 200 
content-type: application/json; charset=utf-8
cache-control: private, no-cache, no-store, must-revalidate
pragma: no-cache
expires: Sat, 01 Jan 2000 00:00:00 GMT
vary: Accept-Language, Cookie, Accept-Encoding
content-language: en
date: Sun, 14 Oct 2018 08:25:46 GMT
content-length: 31852
strict-transport-security: max-age=60
x-frame-options: SAMEORIGIN
content-security-policy-report-only: report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests
set-cookie: rur=FTW; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: urlgen="{\"151.242.133.81\": 31549\054 \"168.63.11.202\": 8075}:1gBbic:EcWDelkIwvmXk_7wBMpa3Pqy-PY"; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: csrftoken=6JeciuKt08Paw4WtaDtQtXoZDQZi4tzr; Domain=.instagram.com; expires=Sun, 13-Oct-2019 08:25:46 GMT; Max-Age=31449600; Path=/; Secure


{"users": [{"position": 0, "user": {"pk": "7068661926", "username": "xtentacionm", "full_name": "xxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/e5ae2f4ce5ada71de3fc628c6d8033a2/5C4DB71F/t51.2885-19/s150x150/36161424_266603240557186_2523081505857601536_n.jpg", "profile_pic_id": "1821571871650150859_7068661926", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 3897, "reel_auto_archive": "on", "byline": "3897 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 15, "user": {"pk": "7660264043", "username": "bfbluefilmfucksexdesi", "full_name": "Xxx sex video bf blue film", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/10cded9657ba95d42a7e06a94d3a2bd3/5C4B8FC4/t51.2885-19/s150x150/31166787_900587163447531_3996875657756803072_n.jpg", "profile_pic_id": "1771613578445630466_7660264043", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 5385, "reel_auto_archive": "unset", "byline": "5385 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 17, "user": {"pk": "6387774601", "username": "fitworkuat", "full_name": "xxxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/24eab8f4d5b3f923cc58d0a953e90e59/5C46F240/t51.2885-19/s150x150/36085249_1884978924891480_6566594499789717504_n.jpg", "profile_pic_id": "1816746776683509238_6387774601", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 12229, "reel_auto_archive": "unset", "byline": "12.2k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 18, "user": {"pk": "6908360373", "username": "xxculitos_bueno", "full_name": "xxx porno", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/062bff676229e61a83c76a7e6e98f2d9/5C3D7D85/t51.2885-19/s150x150/26068972_256260961575335_3893220058041679872_n.jpg", "profile_pic_id": "1690241878980429125_6908360373", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 9988, "reel_auto_archive": "unset", "byline": "9988 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 19, "user": {"pk": "8280627508", "username": "fucking_and_sexx", "full_name": "Xxx_porno", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/95247da3f7ab1db0b05822e49031767d/5C513328/t51.2885-19/s150x150/37908766_443618249455456_7866300789524791296_n.jpg", "profile_pic_id": "1841629881038690953_8280627508", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 9723, "reel_auto_archive": "on", "byline": "9723 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 20, "user": {"pk": "6993484722", "username": "xnxx_video_16", "full_name": "xxx_sexo_pics", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/8acf89eacbdf5783ec4d939b2dfde406/5C5E4437/t51.2885-19/s150x150/29090390_161031378044516_7168619846626705408_n.jpg", "profile_pic_id": "1740681803473426268_6993484722", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 12504, "reel_auto_archive": "unset", "byline": "12.5k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 21, "user": {"pk": "7458627907", "username": "sex_xxnx4501", "full_name": "xxxx.nx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/a3cd1bf57eca98ddf990f9bd711081ec/5C44972C/t51.2885-19/s150x150/30890626_1283491125119689_1463123447386210304_n.jpg", "profile_pic_id": "1771615240708263556_7458627907", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 5694, "reel_auto_archive": "unset", "byline": "5694 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 22, "user": {"pk": "7978168725", "username": "sexyest_bbw", "full_name": "xxxxxxvidoes", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/a7ec0072e98469376bcc6066bf861721/5C565DDE/t51.2885-19/s150x150/35001699_1764230423653288_2085794384187490304_n.jpg", "profile_pic_id": "1798412345943207161_7978168725", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 3769, "reel_auto_archive": "unset", "byline": "3769 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 23, "user": {"pk": "3457885346", "username": "xyz0009___", "full_name": "xxx", "is_private": true, "profile_pic_url": "https://scontent-frt3-1.cdninstagram.com/vp/a8539c22ed9fec8e1c43b538b1ebfd1d/5C5A1A7A/t51.2885-19/11906329_960233084022564_1448528159_a.jpg", "is_verified": false, "has_anonymous_profile_picture": true, "follower_count": 227850, "reel_auto_archive": "on", "byline": "227k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 24, "user": {"pk": "3966638792", "username": "p.o.r.n.o.and.x.x.x", "full_name": "\u2b50\u2b50porno_xxx\u2b50\u2b50", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/aa2b0fcf1c72b1b979a3e67dcbcfe173/5C4C7B3A/t51.2885-19/s150x150/25005660_343283069474076_6513919895590141952_n.jpg", "profile_pic_id": "1436578521149112140_3966638792", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 17143, "reel_auto_archive": "unset", "byline": "17.1k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 25, "user": {"pk": "8077761268", "username": "misculos_y_cosas_sex", "full_name": "porno xxx sex", "is_private": false, "profile_pic_url": "https://scontent-frt3-1.cdninstagram.com/vp/a8539c22ed9fec8e1c43b538b1ebfd1d/5C5A1A7A/t51.2885-19/11906329_960233084022564_1448528159_a.jpg", "is_verified": false, "has_anonymous_profile_picture": true, "follower_count": 4946, "reel_auto_archive": "on", "byline": "4946 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 26, "user": {"pk": "6894879260", "username": "gajas_nuas._", "full_name": "xxx. xxxxxxxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/f78a3e08bfe72410343a6257f2c937d0/5C4BBD89/t51.2885-19/s150x150/26157876_955229157965255_5095242474884956160_n.jpg", "profile_pic_id": "1688567785385833245_6894879260", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 5780, "reel_auto_archive": "unset", "byline": "5780 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 27, "user": {"pk": "7661293220", "username": "hotty_update", "full_name": "XXX VIDEO DM ME \ud83d\udd35", "is_private": true, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/6a571edc260d291c0019b6420107bbac/5C574C75/t51.2885-19/s150x150/42593429_240353946635049_5063694174864277504_n.jpg", "profile_pic_id": "1887693494074423778_7661293220", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 27028, "reel_auto_archive": "on", "byline": "27k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 28, "user": {"pk": "8914052333", "username": "sexo.x_abc", "full_name": "Xxx Sexo", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/bdb970655ed76e417d5818682394fcbc/5C5CEED4/t51.2885-19/s150x150/38817423_2184773555126431_3989413474202550272_n.jpg", "profile_pic_id": "1851377199761641029_8914052333", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 1187, "reel_auto_archive": "unset", "byline": "1187 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 29, "user": {"pk": "2492746597", "username": "ass_bundas", "full_name": "xxx photo", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/146cb512a49304799eed219e48330219/5C408ABD/t51.2885-19/s150x150/13285377_235618950148202_820929696_a.jpg", "profile_pic_id": "1258398566432962874_2492746597", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 31336, "reel_auto_archive": "unset", "byline": "31.3k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 30, "user": {"pk": "7803495494", "username": "adult.videossss", "full_name": "XXX Videos", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/47bb53fa4867052b6ba052eab5f884e0/5C3C6CAC/t51.2885-19/s150x150/32379781_942286609286034_7157731782408798208_n.jpg", "profile_pic_id": "1783874365534706767_7803495494", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 6850, "reel_auto_archive": "on", "byline": "6850 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 31, "user": {"pk": "6408745220", "username": "divasfigures", "full_name": "slayers xxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/6d9ee98d81190dd095de0c283c74504c/5C6224D4/t51.2885-19/s150x150/41307698_470872870078786_3183888780129992704_n.jpg", "profile_pic_id": "1870546630505421696_6408745220", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 34361, "reel_auto_archive": "on", "byline": "34.3k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 32, "user": {"pk": "2531089703", "username": "v.i.d.e.o.s_x.x.x", "full_name": "Videos XXX", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/8ece0f483c1fb9abb8f82087d8672987/5C5CD676/t51.2885-19/s150x150/25016338_1440997139332531_4161944977657561088_n.jpg", "profile_pic_id": "1674552376650044642_2531089703", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 2390, "reel_auto_archive": "unset", "byline": "2390 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 33, "user": {"pk": "7699639177", "username": "video_s_e_x_y", "full_name": "sexy xxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/c8589ab92a0d53c1296f3bafaab9c169/5C52A197/t51.2885-19/s150x150/31729680_622186748142780_6656343094184640512_n.jpg", "profile_pic_id": "1774785536634872499_7699639177", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 4836, "reel_auto_archive": "unset", "byline": "4836 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 34, "user": {"pk": "5488402780", "username": "xx_xx_seks", "full_name": "\u0445\u0445\u0445\u0445\u0445\u0445", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/656a4c8c5d53711a70ebce118d021fbd/5C5AE422/t51.2885-19/s150x150/18579631_419953981719078_3182656459523489792_a.jpg", "profile_pic_id": "1518881848414038877_5488402780", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 2956, "reel_auto_archive": "unset", "byline": "2956 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 35, "user": {"pk": "238092556", "username": "youngellens", "full_name": "XXX\ud83e\udd40..", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/4f1a536d9d42eb860e039833f9f327c0/5C564F3C/t51.2885-19/s150x150/39506730_2182423255329524_1302873351374503936_n.jpg", "profile_pic_id": "1857640846560705218_238092556", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 70029, "reel_auto_archive": "on", "byline": "70k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 36, "user": {"pk": "7355617135", "username": "galeryangels", "full_name": "Gairah Remaja XXX", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/df83f12981e41451a47bfa74fb340b70/5C5C7787/t51.2885-19/s150x150/42847983_301165177379354_5295148772739776512_n.jpg", "profile_pic_id": "1885456700993700560_7355617135", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 10922, "reel_auto_archive": "unset", "byline": "10.9k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 37, "user": {"pk": "703043296", "username": "xxxfanzine", "full_name": "xXx Fanzine", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/f57a4eb04608c43b5db7386c09cdc430/5C5D884F/t51.2885-19/s150x150/16788699_323659674697446_8634996267883167744_a.jpg", "profile_pic_id": "1451955599973528478_703043296", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 12093, "reel_auto_archive": "on", "byline": "12k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 38, "user": {"pk": "1451025673", "username": "v.stormxx", "full_name": "Victoria_Storm xxx", "is_private": true, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/28330f676a619a9642bcbb40ffb90b44/5C4A98FF/t51.2885-19/s150x150/42150450_180053996218974_7357785681109712896_n.jpg", "profile_pic_id": "1886769455741322400_1451025673", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 1844, "reel_auto_archive": "on", "byline": "1844 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 39, "user": {"pk": "7704650714", "username": "worlddvirals", "full_name": "XXXTentacion", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/705f832b2c518b7cf4339404c9540856/5C45DF96/t51.2885-19/s150x150/41714083_537266463412204_6719154718850940928_n.jpg", "profile_pic_id": "1877373342812388209_7704650714", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 13792, "reel_auto_archive": "on", "byline": "13.7k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 40, "user": {"pk": "744078735", "username": "rameusico", "full_name": "xxxrameus", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/ab68a1450c6dfddde024b7b955086a60/5C630107/t51.2885-19/s150x150/39242094_668238583563477_6677197810401542144_n.jpg", "profile_pic_id": "1854549164491483803_744078735", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 5367, "reel_auto_archive": "on", "byline": "5367 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 41, "user": {"pk": "7131156204", "username": "veryvare", "full_name": "xxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/eb918d7e8964d16c9c5c8b255805c775/5C463129/t51.2885-19/s150x150/42634332_566569160464888_7702071320413995008_n.jpg", "profile_pic_id": "1884178707327155554_7131156204", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 5371, "reel_auto_archive": "on", "byline": "5371 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 42, "user": {"pk": "6299445317", "username": "xvro17x", "full_name": "XXX", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/98813453353849677c829b7b6910db47/5C462264/t51.2885-19/s150x150/38517576_495354537598453_8480994451638976512_n.jpg", "profile_pic_id": "1849161046047063574_6299445317", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 3799, "reel_auto_archive": "on", "byline": "3799 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 43, "user": {"pk": "8316360575", "username": "jahsehsbich", "full_name": "xxxtentacion", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/a1cbb1f282f71e58cc19db9840032b48/5C427204/t51.2885-19/s150x150/42453302_490008391475215_1741446545166827520_n.jpg", "profile_pic_id": "1879071525652799613_8316360575", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 14219, "reel_auto_archive": "on", "byline": "14.2k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 44, "user": {"pk": "6786293330", "username": "xxtentaceon", "full_name": "XXXTENTACION", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/2a9bd66e7d2626c4a92ed0cf543e61ff/5C3FE81A/t51.2885-19/s150x150/26395862_433265990425938_461922259511017472_n.jpg", "profile_pic_id": "1701823209311428459_6786293330", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 42197, "reel_auto_archive": "on", "byline": "42.1k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 45, "user": {"pk": "6044855055", "username": "ndugu.lawama__tintinnabulum", "full_name": "xxxx video", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/f3748788ac0558bee482e8ac09f9f941/5C50EF12/t51.2885-19/s150x150/21827329_310017429406726_2811961959669301248_n.jpg", "profile_pic_id": "1608814397172763935_6044855055", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 9616, "reel_auto_archive": "unset", "byline": "9616 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 46, "user": {"pk": "7317896065", "username": "nsfw_videos", "full_name": "sexy videos/ hot videos/xxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/95580a6ce6e6098c70f35c2d891e5bdf/5C6110A7/t51.2885-19/s150x150/40125559_569497506817961_4095783634982666240_n.jpg", "profile_pic_id": "1742172283625876835_7317896065", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 43668, "reel_auto_archive": "on", "byline": "43.6k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 47, "user": {"pk": "5711023711", "username": "clubmasiofficial", "full_name": "Maserati XXX", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/0f002e664810bce68ae1da4e60aef923/5C3C35CD/t51.2885-19/s150x150/19984601_1726371750996589_8811945763677405184_a.jpg", "profile_pic_id": "1554866795697372209_5711023711", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 175364, "reel_auto_archive": "off", "byline": "175k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 48, "user": {"pk": "2080536438", "username": "novacanexoxo", "full_name": "model | XXX \ud83d\udc95 adults only \ud83d\udc44\ud83c\udf39", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/18344f09f75b2c4e1e78e46e43867101/5C4ECF67/t51.2885-19/s150x150/37917787_2001398620082549_7100457873825595392_n.jpg", "profile_pic_id": "1838787825706563724_2080536438", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 17401, "reel_auto_archive": "unset", "byline": "17.4k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 49, "user": {"pk": "8231857430", "username": "aaaking33", "full_name": "xxxx---sexy king", "is_private": true, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/a1d7f3f5c4b455b2d570a56cf543818f/5C551310/t51.2885-19/s150x150/38022158_1097969030379696_7999477000840413184_n.jpg", "profile_pic_id": "1840164277479816656_8231857430", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 65, "reel_auto_archive": "on", "byline": "65 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 50, "user": {"pk": "8299632075", "username": "putillas_favoritas", "full_name": "modelos xxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/8f5505795f4c93fd6dbbd3f26a175ef2/5C4FF710/t51.2885-19/s150x150/39013979_304128547045743_8131189491596525568_n.jpg", "profile_pic_id": "1854285527403357284_8299632075", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 2659, "reel_auto_archive": "on", "byline": "2659 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 51, "user": {"pk": "6246465985", "username": "ashleyadams_official", "full_name": "Ashley Adams xxx", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/1b7c4f0fcba02372ef8dc11d94ab360d/5C3FFAA9/t51.2885-19/s150x150/41092313_1892882554352670_6631454458783989760_n.jpg", "profile_pic_id": "1872954804649828524_6246465985", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 70278, "reel_auto_archive": "on", "byline": "70.2k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 52, "user": {"pk": "7275230978", "username": "pattern.x", "full_name": "x x x \u2022 p a t t e r n \u2022 x x x", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/2d383b23603ac6b59a8c5da894443f65/5C53EF1C/t51.2885-19/s150x150/30884579_712115075579493_8063051025151426560_n.jpg", "profile_pic_id": "1766929016773002098_7275230978", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 34053, "reel_auto_archive": "on", "byline": "34k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 53, "user": {"pk": "6868294523", "username": "xxtentacionnumb", "full_name": "\ud83d\udd25 Daily XXXTENTACION \ud83d\udd2e", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/dd1342711c1f4f792f8cf89d6ad4b7dd/5C577C11/t51.2885-19/s150x150/43820576_957047761147413_7273570099808698368_n.jpg", "profile_pic_id": "1887116059182399553_6868294523", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 9584, "reel_auto_archive": "on", "byline": "9584 followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 54, "user": {"pk": "4175587826", "username": "bobderehrenmann", "full_name": "XXX", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/07426754fd0558566c8213f57cf6deb7/5C59DBA2/t51.2885-19/s150x150/19227244_324860601288530_3312318369683734528_a.jpg", "profile_pic_id": "1541358303389201661_4175587826", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 16187, "reel_auto_archive": "on", "byline": "16.1k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 55, "user": {"pk": "3663338531", "username": "mizzjadathyck", "full_name": "Mizz Jada Thyck XXX", "is_private": true, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/6b5fe0abef8411dd8beb92bc3ec49ae6/5C5C11B3/t51.2885-19/s150x150/23421670_1742510969154184_6469735561266462720_n.jpg", "profile_pic_id": "1645186754255718085_3663338531", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 193073, "reel_auto_archive": "on", "byline": "193k followers", "mutual_followers_count": 0.0, "unseen_count": 0}}, {"position": 56, "user": {"pk": "5539213762", "username": "jahsehxo", "full_name": "Jah", "is_private": false, "profile_pic_url": "https://scontent-frx5-1.cdninstagram.com/vp/179ff4e77ce16f3b6651739eaca939e8/5C61A148/t51.2885-19/s150x150/42429213_1132979643519727_340172873110913024_n.jpg", "profile_pic_id": "1889708349894065603_5539213762", "is_verified": false, "has_anonymous_profile_picture": false, "follower_count": 58439, "0.6063273796342663", "clear_client_cache": false, "status": "ok"}

我想使用cut , sed or awk向我显示仅输出Username的ID(如果它们是"is_private": false

预期输出:

xtentacionm

bfbluefilmfucksexdesi

... (不包括任何"is_private": true

1 个答案:

答案 0 :(得分:1)

您需要解析JSON。使用Perl相当简单:

perl -MJSON::PP -wle 'print $_->{user}->{username} for grep { !$_->{user}->{is_private}} @{ decode_json(<>)->{users}}'

这将使用您的Perl中随附的JSON::PP模块。

一种替代方法是使用jq工具,该工具可让您以其他方式查询JSON。