目录

目录

我有兴趣在acka 上运行搜索RStudio项目目录主要包含*.R脚本文件,但也包含一些项目文件和常用*.git文件。

目录

从默认创建的项目文件夹结构闪亮的应用:

$ tree
.
├── SomeNosense.Rproj
├── server.R
└── ui.R

搜索

鉴于此,我有兴趣运行一个简单的单词搜索老的横跨*.R仅文件。作为默认项目创建的示例闪亮应用程序有一些字符串,其中单词老的被提到

ack -i -rr 'Old'

我得到的结果与应对应的结果不匹配ack --help-types,显示:

--[no]rr           .R

结果

而我的这个命令的结果非常混乱:

.Rproj.user/38B87E11/sdb/s-FEC4716C/28624A5C
7:    "folds" : "",

.Rproj.user/38B87E11/sdb/s-FEC4716C/8A580C19
3:    "contents" : "\n# This is the user-interface definition of a Shiny web application.\n# You can find out more about building applications with Shiny here:\n#\n# http://shiny.rstudio.com\n#\n\nlibrary(shiny)\n\nshinyUI(fluidPage(\n\n  # Application title\n  titlePanel(\"Old Faithful Geyser Data\"),\n\n  # Sidebar with a slider input for number of bins\n  sidebarLayout(\n    sidebarPanel(\n      sliderInput(\"bins\",\n                  \"Number of bins:\",\n                  min = 1,\n                  max = 50,\n                  value = 30)\n    ),\n\n    # Show a plot of the generated distribution\n    mainPanel(\n      plotOutput(\"distPlot\")\n    )\n  )\n))\n",
7:    "folds" : "",

ui.R
13:  titlePanel("Old Faithful Geyser Data"),

期望的结果

可以通过以下方式实现期望的结果grep

me-547/47:SomeNosense$ grep -r -i 'old' ~/Documents/SomeNosense/*.R
/Users/me/Documents/SomeNosense/ui.R:  titlePanel("Old Faithful Geyser Data"),

问题

我的怎么了命令我没有得到相同的结果?


ag似乎也返回了更准确的结果:

me-552/52:SomeNosense$ ag -rr -i 'old'
ui.R
13:  titlePanel("Old Faithful Geyser Data"),
me-553/53:SomeNosense$ ack -rr -i 'old'
.Rproj.user/38B87E11/sdb/per/t/28624A5C
7:    "folds" : "",

.Rproj.user/38B87E11/sdb/per/t/8A580C19
3:    "contents" : "\n# This is the user-interface definition of a Shiny web application.\n# You can find out more about building applications with Shiny here:\n#\n# http://shiny.rstudio.com\n#\n\nlibrary(shiny)\n\nshinyUI(fluidPage(\n\n  # Application title\n  titlePanel(\"Old Faithful Geyser Data\"),\n\n  # Sidebar with a slider input for number of bins\n  sidebarLayout(\n    sidebarPanel(\n      sliderInput(\"bins\",\n                  \"Number of bins:\",\n                  min = 1,\n                  max = 50,\n                  value = 30)\n    ),\n\n    # Show a plot of the generated distribution\n    mainPanel(\n      plotOutput(\"distPlot\")\n    )\n  )\n))\n",
7:    "folds" : "",

ui.R
13:  titlePanel("Old Faithful Geyser Data"),

RStudio:1.0.143

相关内容