grep路径作为一个模式在afile

时间:2018-03-08 04:54:35

标签: shell grep

我有一个以下文件

cat test.txt 

/mount/u001/oracle/product/12.1.0.2    41004360                                        

/mount/u001/oracle                     7186360 

我只想准确地说#34; / mount / u001 / oracle"

grep -w" / mount / u001 / oracle" test.txt给出

/mount/u001/oracle/product/12.1.0.2    41004360                                                                        

/mount/u001/oracle                     7186360 


grep "\b/mount/u001/oracle\b" test.txt -- no result                          

grep "^\/mount/u001/oracle\$" test.txt -- no result 

1 个答案:

答案 0 :(得分:0)

哇..这对我有用

  grep "^\/mount/u001/oracle$" test.txt