I want to search for multiple strings by combining grep and xargs.

Asked 5 months ago, Updated 5 months ago, 12 views

Please tell me the commands to do what you want to do below.


Apple google

$catword.txt | xargs grep-nr.
This won't work!

You want to search log1-3 in the current directory for lines that contain at least one of the strings Apple, Google, or Facebook.Finding, grep, and xargs combinations of find, grep, and xargs can be used to search for specific words across multiple files, but I couldn't find out what I wanted to do.

Thank you for your cooperation.


2022-09-30 11:55

1 Answers

For Linux, I think it's GNU grep, so use the -f option.

$grep-word.txt log {1..3}

(metropolis's Comments

2022-09-30 11:55

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.