How to use grep to match multiple strings in the same line?

grep 'string1\|string2' filename
grep -E "string1|string2" filename



1. Quote AND/OR escape
Code:
 ls | grep "\-a"
(that \ is the escape character)
or
2. Use flag "--" to stop switch parsing
Code:
ls | grep -- -a

相关文章:

  • 2021-05-17
  • 2021-11-27
  • 2021-06-17
  • 2021-11-24
  • 2021-11-27
  • 2021-11-27
  • 2021-11-27
  • 2021-11-27
猜你喜欢
  • 2021-11-27
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案