XARGS, GREP, and GNU are parallel

Being new to Linux, I find it difficult to understand some basic aspects of text search.

I want to do the following: I have a absolutepaths list file for a specific path.

  • I want to view this list of files and grep for a specific template
  • If the template is found in this file, I would like to redirect it to another output file.
  • Since these files are distributed on NFS, I would like to speed up the search using parallel GNU.

So what I did was the following:

cat filepaths|xargs -iSomePath echo grep -Pl '\d+,\d+,\d+,\d+' \"SomePath\"> FoundPatternsInFile.out| parallel -v -j 30 

When I run this command, I repeatedly receive the following message:

 grep: "/path/to/file/name": No such file or directory 

File and path exist. Can someone point out what I can do wrong with xargs and grep?

thanks

+4
source share
1 answer
 cat filepaths | parallel -j 30 grep -Pl '\d+,\d+,\d+,\d+' {} > FoundPatternsInFile.out 

In this case, you can even leave {}.

+3
source

Source: https://habr.com/ru/post/1402483/


All Articles