bash - 如何在 Bash 中以分隔符 ` 分割字符串?

标签 bash pipe pipeline

如何通过管道仅在以​​下内容上获取modules/bx/motif

$ find . | grep denied
find: `modules/bx/motif': Permission denied

最佳答案

就是这样,使用sed:

find . 2>&1 | sed 's/^[^:]*: .\(.*\).: Permission denied/\1/p;d'

或使用仅,

正如你的问题代表 :

string=$'find: `modules/bx/motif\047: Permission denied'
echo $string 
find: `modules/bx/motif': Permission denied

part=${string#*\`} 
echo ${part%\'*}
modules/bx/motif

关于bash - 如何在 Bash 中以分隔符 ` 分割字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49431602/

相关文章:

python - 带有 OHE 的 ColumnTransformer 和 Pipeline - 执行 ct 后 OHE 编码字段是保留还是删除?

bash - 按染色体(行标题)将文件拆分为新文件

Linux 命令模糊重定向

linux - 迭代 shell 脚本中的所有字母和数字

azure-devops - 如何为 Nuget Artifact 配置 Azure Devops Pipeline 包名称

ffmpeg - GStreamer 强制 decodebin2 输出类型

linux - 使用 Bash 将多个相似的行拆分为两个单独的文件

Linux 为什么我不能通过管道找到结果到 rm?

c++ - 执行 popen(),将 FILE* 指针放入 fstream,那么 pclose() 呢?

c - 管道导致进程卡住