目次

目次

私はack次の検索に興味があります。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

ベストアンサー1

おすすめ記事