목차

목차

나는 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

관련 정보