删除linux上的文件中的字符串

时间:2016-03-02 12:31:35

标签: linux mongodb sed

我希望删除_id字段及其更改的值:

{ "_id" : { "$oid" : "54da1bee58743hd23947f493" }, "name":"david", "age":"33"}
{ "_id" : { "$oid" : "5422222222222345d9f1f493" }, "name":"Dove", "age":"33"}
{ "_id" : { "$oid" : "54da1be57a4b727669f1f493" }, "name":"man", "age":"23"}


outcome:
{"name":"david","age":"33"}
{"name":"Dove", "age":"33"}
{"name":"man", "age":"23"}

我想使用sed或任何其他命令。

1 个答案:

答案 0 :(得分:3)

使用jq很容易。

{"name":"david","age":"33"}
{"name":"Dove","age":"33"}
{"name":"man","age":"23"}

O / P:

Glide.with(getContext()).load(imageUrl +".png")
   .fitCenter()
   .listener(new RequestListener<String, GlideDrawable>() {
      @Override
      public boolean onException(Exception e,
                                 String model,
                                 Target<GlideDrawable> target,
                                 boolean isFirstResource)
      {
         return false;
      }

      @Override
      public boolean onResourceReady(GlideDrawable resource,
                                     String model,
                                     Target<GlideDrawable> target,
                                     boolean isFromMemoryCache,
                                     boolean isFirstResource)
      {
         icon.setVisibility(View.VISIBLE);
      }
   }).into(icon);