如何只使用Mac中特定单词开头的行?

时间:2015-08-24 07:29:25

标签: macos shell terminal sublimetext2

我有一个文本文件。

我想用特定的单词“" length ="

grep 开始的所有行

终端\使用sublime中的哪一行可以运行以仅获取这些行?

文本:

   }, {
      "path" : "{\"segmentId\":22439323,\"nodeId\":18437268,\"x\":-71.205646,\"y\":42.38619}",
      "distance" : 2744,
      "length" : 73,
      "instruction" : {
        "opcode" : "CONTINUE"
      },
      "crossTime" : 5,
      "additionalInstruction" : null,
      "detourSavings" : 0,
      "isToll" : false,
      "knownDirection" : true
    }, {
      "path" : "{\"segmentId\":67031059,\"nodeId\":18404240,\"x\":-71.206302,\"y\":42.38574800000001}",
      "distance" : 2749,
      "length" : 9,
      "instruction" : {
        "opcode" : "CONTINUE"
      },
      "crossTime" : 1,
      "additionalInstruction" : null,
      "detourSavings" : 0,
      "isToll" : false,
      "knownDirection" : true
    }, {

1 个答案:

答案 0 :(得分:0)

假设您需要找到"length" :的行,这可以完成工作:

 grep '^\s*"length" :' yourfile