I have a small problem with the input redirection.
to search for a particular pattern in all files i have used this command
this would give me the output in the format
filename : line number : matching line
I would like to have something like this in my output file
filename : line number : matching line : match
the solution that i wondering was that i would redirect my output to another command
so my new structure would look like
my the output from tee has to be redirected in a correct way which would make this code to work fine.
to search for a particular pattern in all files i have used this command
Code:
find $dir -type f -print | xargs grep -E -n -w <pattern> | tee my res.txt
filename : line number : matching line
I would like to have something like this in my output file
filename : line number : matching line : match
the solution that i wondering was that i would redirect my output to another command
Code:
grep -o <pattern>
Code:
find $dir -type f -print | xargs grep -E -n -w <pattern> | tee -a my res.txt | grep -o pattern | tee -a myres.txt
Comment