I am trying to concatenate the results of my grep search.
my grep search finds about 4 files on my system and outputs them in a new line for each file. I thought by passing this information to tr '\n' ' '
I would get all of the files from the search on one line and then pass it to cat > bigfile
to have big file contain all of the files content from my search. Instead bigfile
just contains the list of files that grep found.
How do I make bigfile
contain a concatenation of all of the files that grep found.
Here is the code I have tried:
egrep -Rl 'users.*log|log.*users' /home/moose/test | tr '\n' ' ' | cat > bigfile
and then bigfile
contains:
/home/moose/test/file1 /home/moose/test/2 /home/moose/test/3 /home/moose/moose/file4
Thank You