从与sed模式不匹配的文件中删除行

从与sed模式不匹配的文件中删除行,sed,Sed,我使用 我想删除所有不以某个文件扩展名结尾的文件,例如.h。我正在试这个 sed -ne '/.h$/p' filelist > filelist_h 但是这允许像C:/dev/boost/boost\u 1\u 59\u 0/boost/graph这样的文件。如何使用.h而不是h?find是您需要的工具: find "$DIRPATH" -type f -name '*.h' find是您正在寻找的工具: find "$DIRPATH" -type f -name '*.h' fi

我使用

我想删除所有不以某个文件扩展名结尾的文件,例如
.h
。我正在试这个

sed -ne '/.h$/p' filelist > filelist_h

但是这允许像
C:/dev/boost/boost\u 1\u 59\u 0/boost/graph这样的文件。如何使用
.h
而不是
h

find
是您需要的工具:

find "$DIRPATH" -type f -name '*.h'

find
是您正在寻找的工具:

find "$DIRPATH" -type f -name '*.h'

find
是您正在寻找的工具:

find "$DIRPATH" -type f -name '*.h'

find
是您正在寻找的工具:

find "$DIRPATH" -type f -name '*.h'

表示正则表达式中的任何字符。您需要转义为literal
。但是,您应该使用
find
表示正则表达式中的任何字符。您需要转义为literal
。但是,您应该使用
find
表示正则表达式中的任何字符。您需要转义为literal
。但是,您应该使用
find
表示正则表达式中的任何字符。您需要转义为literal
。然而,
find
是您应该使用的。