Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • If my filename is abc and I am using cat abc | awk '{print $1,"\n"$3}'| xargs -I {} grep {} def ,but is not showing any result @Shellmode Commented Sep 13, 2015 at 16:28
  • xarg -I {} makes abc & def both to be "{}", and you can use the "{}" to be the pattern of grep. Exmaple: If you want to find lines in file named test.txt match the pattern abc or def. And the pattern is the output of cat pattern. You can have a try: cat pattern | xargs -I {} sh -c 'grep $1 test.txt' --{} Commented Sep 14, 2015 at 1:39