I want to pick out certain lines containing a given number from a file.
The file I want to search is called os_clusters/piRNA_clusters.bed
.
awk '{if (a[$0]++ == 0) {split($0,b,"."); ;split(b[1],c,"r"); print c[3]}};' test_non_enriched | xargs grep {} os_clusters/piRNA_clusters.bed
The first part, before the pipe, works- it produces the terms to search for, such as 8707, 8824 etc. However, the latter part does not.
awk '' ... | xargs grep {} os_clusters/piRNA_clusters.bed
Instead of searching the target file for the terms produced by the pipe, it considers the search terms as the input file. Hence, I get error messages like:
grep: 8707: No such file or directory
grep: 8824: No such file or directory
What do I need to change to search the file os_clusters/piRNA_clusters.bed
for the terms produced by the pipe?