less命令如何搜索多个字符

1,369 阅读1分钟

less命令详解

参考这篇文章

less命令如何搜索多个字符

参考这个

搜索多个字符串并且这几个字符串在同一行日志文件中

When you want to search for string1 or string2, use /string1|string2. You said you wanted lines where you find both:

/string1.*string2

When you do not know the order in the line and want to see the complete line, you will need

/.*string1.*string2.*|.*string2.*string1.*

Or shorter

/.*(string1.*string2|string2.*string1).*

Combining more words without a fixed order will become a mess, and filtering first with awk is nice.