【发布时间】:2015-06-27 22:34:54
【问题描述】:
我正在尝试在“output2”文件中进行以下模式搜索,但即使 grep 命令的状态显示成功,它也没有给出所需的输出。
➜ automate git:(master) ✗ grep -F "@PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")" output2
➜ automate git:(master) ✗ grep -nF "@PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")" output2
➜ automate git:(master) ✗ echo $?
0
➜ automate git:(master) ✗
下面的 output2 文件的内容:
/home/workspace/OutputWithMessages.txt:1549:+ @PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")
/home/workspace/OutputWithMessages.txt:3254:+ @PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")
/home/workspace/OutputWithMessages.txt:4558:+ @PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")
/home/workspace/OutputWithMessages.txt:5438:+ @PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")
/home/workspace/OutputWithMessages.txt:5744:+ @PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")
/home/workspace/OutputWithMessages.txt:6986:+ @PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus, 'MAX_LOAN_AMOUNT_FOR_APPROVE')")
/home/workspace/OutputWithMessages.txt:7344:+ @PreAuthorize("isFullyAuthenticated() and hasPermission(#updateStatus,
【问题讨论】:
-
尝试用单引号代替字符串引用?
标签: bash shell unix scripting grep