我希望能够在单词列表中提取特定长度的单词并将其提取到另一个列表中。
如果我跑:
request.requestHeaders
eveything运行正常并且单词被提取但是当我在bash脚本中运行时,没有任何输出。如果我把双引号,因为它导致读取长度数,我仍然会得到语法错误。所以脚本看起来像这样:
grep -oP '\b(\w{7})\b' infile >> outfile
我缺少什么?
答案 0 :(得分:0)
你需要有双引号,以便bash扩展字符串中的变量
尝试
library(shiny)
library(shinyWidgets)
library(shinythemes)
library(datasets)
shinyApp(
ui = navbarPage(
"Real Time Instruments",
############################# Page 1 #############################
tabPanel("Training",
mainPanel(
actionButton("analyse", "Train Model", width = "100%")
)
############################# Page 2 #############################
),
tabPanel("Results",
tableOutput ( "error"),
plotOutput("predict_plot", inline = TRUE)
)
),
server = function(input, output, session) {
### Analyse the data
analyse <- observeEvent(input$analyse , {
# Run the Analysis
AllElements <- data.frame( x = 1:10 )
# populate the results
populateResults (AllElements)
})
#### Results Page ####
populateResults <- function (allElements) {
# First the error table
output$error <- renderTable(allElements$error_sd, digits = 5) ## <--- THIS WORKS!!!
# Second Plots
# par(mar = rep(2, 4)) # Might be needed
x <- allElements$x
xlab <- allElements$x
y <- allElements$x
ylab <- allElements$x
# Plot Predict Var
output$predict_plot <- renderPlot({plot (x, y)}) # <--- THIS DOESN'T WORK!!!
}
})
}
)
看到它在行动:
输入文件
grep -oP "\b(\w{$char})\b"
脚本:
$ cat file1
dockerkill container
docker anothercontainer
dockerput contain
输出
$ cat script.sh
char="6"
grep -oP "\b(\w{$char})\b" file1