我想从 JSON 数据文件中提取用户名。
[{"username": "Cobra", "user_id": 146231486, "event_type": 2,
"title": null, "class_id": 4211, "war_state" : null,
"superpower_expire_date": 1441178060.0, "role": 3, "event_state": 2,
"avatar_id": 4211, "avatar_type" : 2, "recent_gifts": []},
{"username": "Divineshadow", "user_id": 1622533959, "event_type": 2,
"title" : null, "class_id": 1887, "war_state": null,
"superpower_expire_date": null, "role": 2, "event_state" : 2,
"avatar_id": 1887, "avatar_type": 2, "recent_gifts": []}, {"username":
"-TheLastTrojan_", "user_id" : 1387569472, "event_type": 2, "title":
null, "class_id": 1887, "war_state": null, "superpower_expire_date" :
1440106625.0, "role": 1, "event_state": 3, "avatar_id": 1887,
"avatar_type": 2, "recent_gifts": …Run Code Online (Sandbox Code Playgroud) myscript [-a a-arg] [-c c-arg] [-b] [-e] somedirectory
Run Code Online (Sandbox Code Playgroud)
鉴于我希望使用上述参数在命令行中调用我的 shell 脚本 - 其中 [这些括号] 表示它们是可选的 - 解析它们的最佳方法是什么?
我有一个网址列表,如:
hxxp://url.com/subpage.html
hxxp://www.url2.com/index.php
hxxp://subdomain.url3.com/somepage.php
...
Run Code Online (Sandbox Code Playgroud)
如何使用 grep 仅匹配域名?
所有网址在域后都有一个 / 。并且有很多 tld,不知道有多少,列表相当大。
我不希望它删除其余部分或任何内容,只是为了快速报告包含我刚刚输入的文本的行数。
如何快速找到“此文本中包含我刚刚输入的字符串的行数”?