使用正则表达式列表文件搜索文件只包括单引号

时间:2013-05-30 11:54:11

标签: regex linux

我有文件夹内的文件列表,只需要列出包含单引号的文件名

喜欢image1' .jpg

我用过

find -regex  /home/san/"'.jpg" >> /tmp/output.txt

我在这里想念什么

2 个答案:

答案 0 :(得分:3)

man find说:

   -regex pattern
          File name matches regular expression pattern.  This is a match on the whole path, not a search...

你可能想要:

find /home/san -type f -name "*'*"

答案 1 :(得分:2)

如果您只是在寻找包含撇号的文件,可以使用:

find -regex "/home/san/.*'.*"